Skip to main content

Socket connection checking

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-11-02

Hi All,

I would like to know if there is any socket connection checking can be performed to check if the server socket is disconnected unconditionally? (e.g. network failed, server is down, etc....)

I'm using class to connect to server socket which will send bytes to the client while there is an event detected. The client program will be blocked at read() method to wait for input from server which may be sent at any time.
Unfortunately, the isConnected(), isInputShutdown() methods in Socket class has no changed and no exception will be thrown while the network is unplugged in server side. So I would like to ask if there is any mechanism to check if the server socket is still alive or is there any configuration can be set in order to receive socket exception if server socket is disconnected.

Thanks a lot.