PC Review


Reply
Thread Tools Rate Thread

Client side Remoting Question

 
 
ME
Guest
Posts: n/a
 
      18th Aug 2005
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


 
Reply With Quote
 
 
 
 
Bjarke Lindberg
Guest
Posts: n/a
 
      19th Aug 2005
ME wrote:
> 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.


Hi Matt.

Try calling the obj.ToString() It'll throw an exception, if the object
isn't available (ie. the server is not running).


/B

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill/Remove Context Proxy in Remoting on Client Side? Spam Catcher Microsoft VB .NET 0 13th Jun 2007 11:35 PM
Remoting Types in the client (newbie question) Jayme Pechan Microsoft C# .NET 7 13th Jan 2006 09:56 PM
Client side Remoting Question ME Microsoft Dot NET 1 19th Aug 2005 10:51 AM
remoting client -> interface based question Tom Microsoft Dot NET 1 30th Sep 2004 04:17 PM
remoting client -> interface based question Tom Microsoft C# .NET 1 30th Sep 2004 04:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 PM.