Groups | Blog | Home
all groups > dotnet remoting > january 2006 >

dotnet remoting : Timeout before SocketException



NuTcAsE
1/31/2006 10:19:36 AM
AFAIK there is not support for client side socket timeout in 1.1. In
2.0 this has been added using a configuration setting... but i could be
wrong here...

- NuTcAsE
Code_Hound
1/31/2006 3:52:55 PM
I have an application that talks to a shared add-in via .NET remoting but
occasionally the shared add-in will not be available. This results in a
SocketException as I run my remoting through a TCP channel. I catch this
exception and communicate via a different method. All well and good.
However the time taken from an attempted call to the thrown exception can be
over a minute. This is not acceptable as it impact performance of my
system.

Q. Can I set the default timeout for a remoting call failure to something
more reasonably such as 5 seconds.

Thanks in Advance
Paul

Code_Hound
2/1/2006 12:00:00 AM
Perfect I am using 2.0, could you be more specific? What configuration
setting?

Cheers

[quoted text, click to view]

NuTcAsE
2/1/2006 1:55:45 PM
Full system.runtime.remoting section elements / properties and options:

http://msdn2.microsoft.com/z415cf9a(en-US,VS.80).aspx

Configuration properties for all channels:
http://msdn2.microsoft.com/en-us/library/kw7c6kwc.aspx

The TcpChannel now has a timeout property that you can set...

- NuTcAsE
Code_Hound
2/3/2006 12:00:00 AM
Thanks for that; I've looked up these properties and found some discussions
on the subject for most people something like this seems to work
TcpChannel tcpChannel = new TcpChannel();

ChannelServices.RegisterChannel(tcpChannel, false);

remoteObj= Activator.GetObject(typeof(IRemoteObj),
"tcp://localhost:8085/RemoteObjName") as IRemoteObj;

IDictionary prop = ChannelServices.GetChannelSinkProperties(remoteObj);

prop.Add("timeout", 50);

remoteObj.DoSomething());

For me this does nothing I still have to wait about 30 seconds for the
DoSomething call to timeout.

Any idea what I might be doing wrong?

Cheers

code-hound

[quoted text, click to view]

NuTcAsE
2/6/2006 11:31:26 AM
Try setting the channel properties when you call the RegisterChannel
function. I beleive there is an overload that accepts an IDictionary
with the properties that the channel will be initialized with.

I would also suggest using config files for channel and service
registrations as it reduces code overhead and also more manageable...
again just a suggestion.

- NuTcAsE
Code_Hound
2/15/2006 3:58:30 PM
I have now tried:

IDictionary properties = new Hashtable();

properties["timeout"] = 500;

properties["connectionTimeout"] = 500;

TcpChannel tcpChannel = new TcpChannel(properties, null, null);

ChannelServices.RegisterChannel(tcpChannel, false);

remoteObj= Activator.GetObject(typeof(IRemoteObj),
"tcp://localhost:8085/RemoteObjName") as IRemoteObj;

remoteObj.DoSomething());


But still no effect.

:-(

[quoted text, click to view]

Muzzy
4/18/2006 2:50:02 PM
The "timeout" property seems olny effective for "HttpChannel".
Read the specification carefully.

I also got this problem.
And what i can do is put these calls in a separated thread.

:-(

--
Jobless Cat


[quoted text, click to view]
George VS
5/8/2006 5:31:02 AM
Hi guys,
I have the same problem.
Isn't there anyone from Microsoft who can finally state if it is possible or
not and how it should be coded if possible.

Thanks,
AddThis Social Bookmark Button