Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Client side Remoting Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ME - 18 Aug 2005 23:39 GMT
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
Bjarke Lindberg - 19 Aug 2005 10:51 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.