I'm working on an app that uses .net remoting for IPC.
When my client app starts up, it uses the following code to connect to the server:
chnl = gcnew HttpChannel();
ChannelServices::RegisterChannel(chnl, false);
IPCObjectInstance = (BaseRemoteObject)Activator.GetObject(
typeof(BaseRemoteObject),
"http://localhost:1237/MyRemoteObject.soap");
And, when I make my function call, I use the following code:
BaseRemoteObject.GetFileTextDelegate svd = new BaseRemoteObject.GetFileTextDelegate(IPCObjectInstance, BaseRemoteObject.GetFileText);
AsyncCallback callback = new AsyncCallback(this, &ClientGUI.RecievedStringText);
IAsyncResult arValSet = svd.BeginInvoke(callback, null);
This code works great as is. However, I want my client to detect whether or not the server is running when it boots, and display the appropriate error message.
When the server isn't running, the client waits for about 3 seconds, before throwing a web exception (shown at bottom). There is no error "location", so I'm not sure of where to put the try\catch block.
What is the best way to detect my server not running?
Thanks!