471,618 Members | 1,186 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,618 software developers and data experts.

How to validate the URL ?

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.

Dec 14 '05 #1
1 3024
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(RemoteTyp e);

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

"Prakash" <p.************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.

Dec 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jim Heavey | last post: by
11 posts views Thread by jjbutera | last post: by
reply views Thread by Marc Scheuner | last post: by
4 posts views Thread by Brybot | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.