I can't see a sensible way for connect(2) to determine if it should return ECONNREFUSED without that first SYN/ACK roundtrip. :)
(You'll note that sendmsg(), being intended for connectionless protocols, isn't documented as being able to return ECONNREFUSED either. I suspect this oversight will be rectified in due course.)
Posted Aug 1, 2012 23:00 UTC (Wed) by josh (subscriber, #17465)
[Link]
Just document that if you connect with the TCP_FASTOPEN flag you can potentially get ECONNREFUSED from whatever later call you use to write data to the socket.
TCP Fast Open: expediting web services
Posted Aug 2, 2012 22:56 UTC (Thu) by nix (subscriber, #2304)
[Link]
Quite. The set of errors in the manpages (and, indeed, in POSIX) is not a total set -- the kernel is allowed to return other errors, though it is perhaps unwise to expect callers to expect those errors.
TCP Fast Open: expediting web services
Posted Aug 1, 2012 23:11 UTC (Wed) by dskoll (subscriber, #1630)
[Link]
Well, connect could return EINPROGRESS if the option is used as it does for a non-blocking socket. That's a bit of a lie, though. :)