*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
I have this situation:
1) There is a server on machine S which exposes type T through .NET remoting.
2) There is a client on another machine C which attempts to remotely instantiate the type T on machine S using Activator.GetObject method.
If the S machine is running but the server application (which exposes type T) isn't running, you will get an System.Net.Sockets.SocketException with ErrorCode set to 10061 meaning "No connection could be made because the target machine actively refused it."
If the S machine itself is NOT running you will get an System.Net.Sockets.SocketException with ErrorCode set to 10060 meaning "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.", but after an unreasonable (in my opinion)
long
timeout.
How can I control this timeout? (Within the client applications, of course
)
Use asynchronous calls: BeginConnect() with AsyncCallback
delegate.
That delegate will try to connect to the remote machine and then signals the application thread that the connection is complete by using a global ManualResetEvent object (calling WaitOne()).
Use the same pattern for "send" and "receive" e.g. BeginSend() and BeginReceive().
-obislavu-
Best regards,
Ingo Rammer
Author of "Advanced .NET Remoting"
and "Advanced .NET Remoting in VB .NET"
Red Flag This Post
Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.
RE: Controlling the timeout
obislavu (Programmer)delegate.
That delegate will try to connect to the remote machine and then signals the application thread that the connection is complete by using a global ManualResetEvent object (calling WaitOne()).
Use the same pattern for "send" and "receive" e.g. BeginSend() and BeginReceive().
-obislavu-
RE: Controlling the timeout
B00gyeMan (Programmer)"The TcpChannel doesn't use any timeout at all and also doesn't even allow any timeouts to be set.
For the HttpChannel, things are a little bit different. There's no default timeout, but you can set one using code like the following:
SomeObject obj = Activator.GetObject(typeof(SomeObject)," http://somewhere/some.rem ";);
IDictionary dict = ChannelServices.GetChannelSinkProperties(obj);
dict["timeout"] = 10;
Best regards,
Ingo Rammer
Author of "Advanced .NET Remoting"
and "Advanced .NET Remoting in VB .NET"
Red Flag This Post
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.
Click Here to join Tek-Tips and talk with other members! Already a Member? Login
Join Tek-Tips ® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
Register now while it's still free!
Already a member? Close this window and log in.