Igor Semenov
Igor Semenov

Reputation: 483

Howto check, is transparent proxy refers to dead server?

I'm using server objects via Remoting.

On client I get and keep reference to Transparent Proxy, representing remote object.

But when remote server is "dead" (closed, hang), I'd like to detect it via my proxy reference.

Is it somehow possible?

Upvotes: 1

Views: 436

Answers (1)

T McKeown
T McKeown

Reputation: 12847

The simplest way to achieve that is to implement a Ping() method. I've implemented my own monitoring thread to keep track of live vs dead clients but you could do the same on the client to monitor the server.

Both the client and server implementations could have this Ping() method.

try{
  server.Ping();
}
catch( RemotingException re){
    //99% sure it's a dead or unreachable...
}

The implementation is nothing:

public void Ping() { }

Upvotes: 1

Related Questions