I’m perform non blocking connect to server.
What an appropriate timeout value to be used in select to consider the server down/busy?
P.S.
Connect can fail since server is down or busy.
In case server is down I always will always end with select timeout.
More interesting case is when server is busy. IMHO 1 sec is enough for TCP handshake. If it takes too long time to connect to server, than all communication with the server will be delayed. So would it be reasonable decision wait on select max 1 sec?
Packets can be lost in which case the node will resend it after a timeout so do not use a value that’s just enough for a handshake. You can play a bit with
tcpdump, break the connection (unplug the ethernet cable) and see what’s happening.Something like 10-20 seconds should be fine, but this is depends on how important your task is…