In my server app I perform the following:
//-------------------------------------------
remoteObject remoteObj = new remoteObject();
ChannelServices .RegisterChanne l(new TcpChannel(tcpP ort));
ObjRef refSubManager = RemotingService s.Marshal(remot eObj, "remoteObject") ;
In the Client app I attempt to do this:
//--------------------------------------------
TcpChannel chan = new TcpChannel();
ChannelServices .RegisterChanne l(chan);
object obj = (remoteObject) Activator.GetOb ject(typeof(rem oteObject),
"tcp://" + serverIP + ":" + tcpPort + "/remoteObject");
remoteObjectLoc al = obj as remoteObject;
if (remoteObjectLo cal == null)
{
MessageBox.Show ("Server is not running");
}
else
{
MessageBox.Show ("Server is running");
}
Trouble is since remoteObjectLoc al is a proxy it NEVER returns null (even if
the server is not running). How do I tell from the client side that the
server is serving up the remot object? I can get the proxy when the server
is running, I just need to verify the server is running before attempting to
use the proxied object.
Thanks,
Matt
//-------------------------------------------
remoteObject remoteObj = new remoteObject();
ChannelServices .RegisterChanne l(new TcpChannel(tcpP ort));
ObjRef refSubManager = RemotingService s.Marshal(remot eObj, "remoteObject") ;
In the Client app I attempt to do this:
//--------------------------------------------
TcpChannel chan = new TcpChannel();
ChannelServices .RegisterChanne l(chan);
object obj = (remoteObject) Activator.GetOb ject(typeof(rem oteObject),
"tcp://" + serverIP + ":" + tcpPort + "/remoteObject");
remoteObjectLoc al = obj as remoteObject;
if (remoteObjectLo cal == null)
{
MessageBox.Show ("Server is not running");
}
else
{
MessageBox.Show ("Server is running");
}
Trouble is since remoteObjectLoc al is a proxy it NEVER returns null (even if
the server is not running). How do I tell from the client side that the
server is serving up the remot object? I can get the proxy when the server
is running, I just need to verify the server is running before attempting to
use the proxied object.
Thanks,
Matt
Comment