unpleasant remoting problem

D

David Krmpotic

Hi All!


I have a .NET remoting Client-Server application with Server Activated
Objects only..
something is worrying me.. sometimes (rarely), I can't connect to the server
although it is running.

I get the exception saying "A socket operation was attempted to an
unreachable host".. it means that it behaves the same as if the server
wasn't running.

Firewalls are not the problem here for sure.

I know you can't solve my problem just by knowing this information, but I
wanted to ask you how should I tackle it? with what tools..? is there some
special settings that I can use to force the server at least throw some
exception instead of refusing to accept connections silently.

Thank you!!!!

More code and info about the exception:


CLIENT:

**** example of getting one server-created object refernce

file_transfer_server_view = (FileTransferServerView) Activator.GetObject(
typeof(FileTransferServerView),
"tcp://"+address+"/FileTransferServerView" );


SERVER: Windows Service application


********* INIT ************

//because of security restrictions, the type ObjRef cannot be accessed
//occurs when we want to send MarshalByObjRef as a parameter somewhere
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();

serverProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();

IDictionary props = new Hashtable();
props["port"] = ProjektiServerService.port_num;

TcpChannel channel = new TcpChannel(props, clientProvider, serverProvider);
ChannelServices.RegisterChannel(channel);
Success = true;

*************** example of registering one object ************

RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Projekti.FileTransferServerView),
"FileTransferServerView", WellKnownObjectMode.Singleton );


************ server.config file: ***************
<?xml version="1.0"?>

<configuration>

<system.runtime.remoting>
<customErrors mode="Off"></customErrors>
</system.runtime.remoting>

</configuration>

*************** ERROR I GET AT THE CLIENT, ALTHOUGH THE SERVER SEEMS FINE
(but it's not obviously) **************

A socket operation was attempted to an unreachable host

Server stack trace:
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
machineAndPort)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithR
etry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(I
Message msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessag
e(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at System.Object.FieldGetter(String typeName, String fieldName, Object&
val)
at Projekti.Form1..ctor() in c:\documents and settings\david krmpotic\my
documents\visual studio projects\projekti\projekticlient\mainform.cs:line
208
at Projekti.Form1.Main(String[] args) in c:\documents and settings\david
krmpotic\my documents\visual studio
projects\projekti\projekticlient\mainform.cs:line 729
 
D

David Krmpotic

oh , it's win2k, VS 2003, .net 1.1

thank you again!

and that happened on the same machine... (the client and the server were
running on the same machine)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top