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 / Distributed Applications / December 2005

Tip: Looking for answers? Try searching our database.

How to validate the URL ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Prakash - 14 Dec 2005 10:03 GMT
Hi Friends,

I am developing application based on .net Remoting. In my client
application i have accessed the remote object by Activator.GetObject
function. In this GetObject function, i have passed the second argument
as URL, like "tcp://localhost:8384/Container". From my client program
how can i validate this URL ? i.e., before using this url i need to
identify whether any service is published on this URL or not. Please
help me to solve this issue.

Regards,
Prakash.
Chris Yager - 14 Dec 2005 14:57 GMT
You can use various "ping" methods to see if the ip address exists but that
won't tell you if the server process is running.  You can implement an
interface on your remote objects that expose an IsAlive method that returns
a boolean.  You would need to provide a handler for this interface on the
client but that could be done with a helper object that serves as a client
"object server".  For instance:

client:

RemoteObj remobj=(RemoteObj)RemoteHelper.GetObject(RemoteType);

Remote Object Helper:

class RemoteHelper
{
   public object GetObject(type RemoteType)
   {
       // you can put this code in a loop and loop until you have an Alive
object.
       string URL=[Get a possible url from a config file or whatever]
       IIsAlive obj=(IIsAlive)Activator.GetObject(RemoteType, URL);
       try
       {
           bool bolIsAlive=obj.IsAlive();
       }
       catch(Exception ex)
       {
           Debug.WriteLine("Object is not alive");
       }

   }
}

IIsAlive interface

public interface IIsAlive
{
   bool IsAlive();
}

Have all your remote objects implement the IIsAlive interface.  You can then
have a list of possible urls available at the client so the RemoteHelper can
return an appropriate object.

This is not the most efficient plan but it will serve the purpose.

-chris

> Hi Friends,
>
[quoted text clipped - 8 lines]
> Regards,
> Prakash.

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.