User disconnection not informing Server


Sep 28, 2004
At work we use External USB Modem for the users that are reporting on site, as there is no permanent internet facility available.

I’ve been working on a chat program to link all users together, both the Server and Client are working fine over the internet, but I’ve hit a snag and I’m not to sure how to go about fixing it.

If a user closes the program data arrives to the server which is Zero in length this signifies to the server that the user has disconnected and all other users that are connected are informed of this.

The problem I’ve got is if the connection goes down (on a datacard it can quite often depending on signal strength) or the datacard is disconnected, a signal does not get sent to the Server about the disconnection, this means that:

A: The socket is unavailable to use again as the server is still saying that it’s in use.
B: No other user gets informed of the disconnected user not been available.

Can anybody think of a way around this problem??


Sep 4, 2002
Lancashire, UK
Could the server track how long it is since a particular client sent anything and if it is past a particular threshold have the server close the port.

The client could periodically send a dummy request to the server to keep the connection alive if it hasn't actually had any real information to transmit.


Jun 28, 2006
Hampshire, UK

If the server periodically sends a "ping" style message to the client, eventually network failures will be detected by the underlying transport protocols and then get propagated back to your server application to handle appropriately.

Good luck :cool:
Top Bottom