Blog Archives

TCP State

A connection progresses through a series of states during its lifetime. The states are: LISTEN, SYN-SENT, SYNRECEIVED, ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT, and the fictional state CLOSED. CLOSED is fictional because it represents the state when there is no TCB, and therefore, no connection. Briefly the meanings of the states are:

  • LISTEN represents waiting for a connection request from any remote TCP and port.
  • SYN-SENT represents waiting for a matching connection request after having sent a connection request.
  • SYN-RECEIVED represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.
  • ESTABLISHED represents an open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection.
  • FIN-WAIT-1 represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.
  • FIN-WAIT-2 represents waiting for a connection termination request from the remote TCP.
  • CLOSE-WAIT represents waiting for a connection termination request from the local user.
  • CLOSING represents waiting for a connection termination request acknowledgment from the remote TCP.
  • LAST-ACK represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).
  • TIME-WAIT represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.
  • CLOSED represents no connection state at all.

A TCP connection progresses from one state to another in response to events. The events are the user calls, OPEN, SEND, RECEIVE, CLOSE, ABORT, and STATUS; the incoming segments, particularly those containing the SYN, ACK, RST and FIN flags; and timeouts.

TCP/IP State Transition Diagram (RFC793)

TCP/IP Ilustrated, Volume 1


I paid £29.99 (40% off) 🙂
This is the last book acquired by me. I recomend this book 100%. If you want to understand in deep about TCP/IP, this is a good book. I do not know another ones but this one explains in a good manner all this matter. I do not recommend to beginners. A minimum background in networking is recommended to get some benefit reading this book.
The author is W. Richard Stevens, one of the most famous writers in networking topics. Books written by him:
1990 – UNIX Network Programming – ISBN 0-13-949876-1
1992 – Advanced Programming in the UNIX Environment – ISBN 0-201-56317-7
1994 – TCP/IP Illustrated, Volume 1: The Protocols – ISBN 0-201-63346-9
1995 – TCP/IP Illustrated, Volume 2: The Implementation (with Gary R. Wright) – ISBN 0-201-63354-X
1996 – TCP/IP Illustrated, Volume 3: TCP for Transactions, HTTP, NNTP, and the UNIX Domain Protocols – ISBN 0-201-63495-3
1998 – UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI – ISBN 0-13-490012-X
1999 – UNIX Network Programming, Volume 2, Second Edition: Interprocess Communications – ISBN 0-13-081081-9
2003 – UNIX Network Programming Volume 1, Third Edition: The Sockets Networking API – ISBN 0-13-141155-1 (with Bill Fenner, and Andrew M. Rudoff)
2005 – Advanced Programming in the UNIX Environment, Second Edition – ISBN 0-32-152594-9 (with Stephen A. Rago)

Source: http://www.wikipedia.org