Setting a timeout time for MarshalByRefObject?
-
I have code along the lines of:
try
{
MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
typeof(MyClasss),
"http://MyServer:8080/MyClass");MyClass class = (MyClass)obj; class.CallSomeMethod(); return;
}
catch
{
// don't do anything
return;
}In the above code, if for whatever reason I can't connect to my server, an exception is thrown, I eat it, and move on. That's all expected. What I'd like to know is: Is it possible to set how long the timeout is before the remote request gives up? If the server is down, it can take a while before the exception is thrown - sometimes a minute, and I'd like to limit it to something low, like 10 seconds. Thanks, Jeff
-
I have code along the lines of:
try
{
MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
typeof(MyClasss),
"http://MyServer:8080/MyClass");MyClass class = (MyClass)obj; class.CallSomeMethod(); return;
}
catch
{
// don't do anything
return;
}In the above code, if for whatever reason I can't connect to my server, an exception is thrown, I eat it, and move on. That's all expected. What I'd like to know is: Is it possible to set how long the timeout is before the remote request gives up? If the server is down, it can take a while before the exception is thrown - sometimes a minute, and I'd like to limit it to something low, like 10 seconds. Thanks, Jeff
The HttpClientChannel Class[^] has a "timeout" configuration property. Channel and Formatter Configuration Properties[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
The HttpClientChannel Class[^] has a "timeout" configuration property. Channel and Formatter Configuration Properties[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: