Sockets: Advanced Topics 1271(labeled M in the diagram). This information is necessary because sequence
numbers don’t begin at 0, as noted in Section 58.6.3.- The server TCP must both acknowledge the client TCP’s SYN segment and
inform the client TCP of its own initial sequence number (labeled N in the
diagram). (Two sequence numbers are required because a stream socket is
bidirectional.) The server TCP can perform both operations by returning a single
segment with both the SYN and the ACK control bits set. (We say that the ACK
is piggybacked on the SYN.) - The client TCP sends an ACK segment to acknowledge the server TCP’s SYN
segment.
Figure 61-4: TCP state transition diagram
close^send: FIN (4)closesend: FIN (6)active open; send: SYN (1)recv: FIN
send: ACK
send: <nil>recv: ACKrecv: SYN, ACK (2)
send: ACK (3)recv: ACK (3)
send: <nil>send: <nil>recv: ACK (5)recv: FIN (6)
send: ACK (7)recv: FIN, ACK
send: ACKclose(or timeout)2MSL
timeoutrecv: ACK (7)
send: <nil>passive closeactive closedata-transfer
statepassive openactive openusual path for client boldface: action by local application
usual path for server
Key recv: segment from peer that caused transitionSYN_RECVCLOSE_WAITLAST_ACKCLOSEDSYN_SENTFIN_WAIT1FIN_WAIT2 TIME_WAITsend: segment sent to peer during transitionCLOSINGrecv: FIN (4)
send: ACK (5)ESTABLISHEDopenpassivecloserecv: SYN (1)
send: SYN, ACK (2)LISTENCLOSED