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.