The context of my work is my local area network.
The code samples below are written in Java language but my question is about TCP, not programming.
I have experi
As you have found out, you can specify a timeout in the connect(...)
method call as such:
connect( SocketAddress endpoint , int timeout )
And remember that "...A timeout of zero is interpreted as an infinite timeout." (where "infinite" often really means "use the OS default").
As for the defaults, they are OS dependent, but usually fairly consistent anyways. If you're on a linux box, have a look at /proc/sys/net/ipv4/tcp_keepalive*
(but don't change them unless you know what you're doing :-)
Cheers,