socketChannel.socket().setSoTimeout(ms);
Or did you mean something else?
setSoTimeout() doesn't seem to effect connect() (on windows here at least). SO_TIMEOUT maps to SO_SNDTIMEO and SO_RCVTIMEO in the underlying
setsockopt() which only effect receive and send.
you don't need a timeout, because SC's do a non-blocking Connect, and send a message to the Selector with message type CONNECTED when that becomes the case
Whether or not the socket is in blocking mode you do still want it to stop attempting to connect once packets are failing for a set period - 20 seconds by default. Just because you're not blocked by it doesn't mean you wouldn't like it to stop trying eventually and tell you that it failed. It'd still be nice to be able to configure this like you can directly on the socket.
Would:
1
| socketChannel.socket().connect(address, ms); |
Work?
Kev