Sunday, 24 April 2016

How do I handle timeouts in my networking applications ?


You can use socket options to generate a timeout after a read operation blocks for a specified length of time.

java.net.Socket.setSoTimeout() 
This method allows you to specify the maximum amount of time a Socket I/O operation will block before throwing an InterruptedIOException.
This allows you to trap read timeouts, and handle them correctly.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.