I call connect() on the client. The client enters the SYN_SENT state and sends a SYN. Now it gets a SYN with no ACK in it, so the client enters the SYN_RCVD state.
Does connect() return at this point? Technically you have enough information to be able to call send() and recv() on the socket. The RFC itself says, if you call SEND on a socket in the SYN_RCVD state, to:
SYN-RECEIVED STATE
Queue the data for transmission after entering ESTABLISHED state.
And, if you call RECEIVE:
LISTEN STATE
SYN-SENT STATE
SYN-RECEIVED STATE
Queue for processing after entering ESTABLISHED state. If there
is no room to queue this request, respond with "error:
insufficient resources".
So my question is: does connect() return after getting the SYN, and then a call to recv() would block, or does connect() itself block until the connection is established fully?