• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tracking a dead client ...

 
Ganesh Krishnamurthy-
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
A newbie question. How can a server figure out if a client has been improperly shutdown/has crashed/is dead ? Is there a way of pinging the client ?
thanks in advance.
Ganesh
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no reliable way to do this on a conventional network; as a compromise, the server usually relies on a timeout or other expiration value to decide if it will wait on a client any longer.
Testing the client can also be exploited by a hacker, so you want to think twice about aggressively checking client status.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a common problem. The way that Jini and DHCP tackle it is by using the concept of "leasing".
When a "client" connects to a "server", it asks for a certain duration of claim on the server resources. The server responds with the duration it is willing to offer. If the client does not "renew" the lease by asking again before the offered duration expires, then the connection is revoked and any resources in use may be reclaimd.
In practice this approach allows much finer-grained control compared with typical server-only timeouts. A client which only needs a short connection can be polite and ask for a short "lease", a server which listens on a flaky connection or commits large amounts of resources to each connection is free to request frequent renewals, and so on.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
This is a common problem. The way that Jini and DHCP tackle it is by using the concept of "leasing".
So does RMI. See java.rmi.server.Unreferenced, java.rmi.dgc.Lease,
and the java.rmi.dgc.leaseValue system property.
- Peter
 
Ganesh Krishnamurthy-
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter den Haan:
So does RMI. See java.rmi.server.Unreferenced, java.rmi.dgc.Lease,
and the java.rmi.dgc.leaseValue system property.
- Peter

The problem with the Unreferenced method is that it is called only ALL client objects stop referencing the remote object. It is not particularly helpful when tracking individual clients. Also, I waited for nearly an hour after killing all my clients just to see how long it took to invoke it, without much success.
The leasing solution sounds viable. Thanks all , for your suggestions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!