M
ME
In my server app I perform the following:
//-------------------------------------------
remoteObject remoteObj = new remoteObject();
ChannelServices.RegisterChannel(new TcpChannel(tcpPort));
ObjRef refSubManager = RemotingServices.Marshal(remoteObj, "remoteObject");
In the Client app I attempt to do this:
//--------------------------------------------
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
object obj = (remoteObject) Activator.GetObject(typeof(remoteObject),
"tcp://" + serverIP + ":" + tcpPort + "/remoteObject");
remoteObjectLocal = obj as remoteObject;
if (remoteObjectLocal == null)
{
MessageBox.Show("Server is not running");
}
else
{
MessageBox.Show("Server is running");
}
Trouble is since remoteObjectLocal 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.RegisterChannel(new TcpChannel(tcpPort));
ObjRef refSubManager = RemotingServices.Marshal(remoteObj, "remoteObject");
In the Client app I attempt to do this:
//--------------------------------------------
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
object obj = (remoteObject) Activator.GetObject(typeof(remoteObject),
"tcp://" + serverIP + ":" + tcpPort + "/remoteObject");
remoteObjectLocal = obj as remoteObject;
if (remoteObjectLocal == null)
{
MessageBox.Show("Server is not running");
}
else
{
MessageBox.Show("Server is running");
}
Trouble is since remoteObjectLocal 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