|
Java™ by example!
|
|
|
How do I timeout on a network connection?
If you didn't know that there is a method available, you'd probably think of using a timer thread that closes the connection when it times out. There is an easier way to handle network timeouts. You can have better control over your socket communications using socket options. And, to make developer's life easy, there is this useful option called SO_TIMEOUT.
Now try to run it with different values for timeout:
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|