TCP状态机

将下面的图手抄默写思考100遍,就再也不会忘记了,不用每次都翻书查找了

					 
							 
                             +---------+ ---------\      active OPEN
                             |  CLOSED |            \    -----------
                             +---------+<---------\   \   create TCB
                               |     ^              \   \  snd SYN
                  passive OPEN |     |   CLOSE        \   \
                  ------------ |     | ----------       \   \
                   create TCB  |     | delete TCB         \   \
                               V     |                      \   \
                             +---------+            CLOSE    |    \
                             |  LISTEN |          ---------- |     |
                             +---------+          delete TCB |     |
                  rcv SYN      |     |     SEND              |     |
                 -----------   |     |    -------            |     V
+---------+      snd SYN,ACK  /       \   snd SYN          +---------+
|         |<-----------------           ------------------>|         |
|   SYN   |                    rcv SYN                     |   SYN   |
|   RCVD  |<-----------------------------------------------|   SENT  |
|         |                    snd ACK                     |         |
|         |------------------           -------------------|         |
+---------+   rcv ACK of SYN  \       /  rcv SYN,ACK       +---------+
  |           --------------   |     |   -----------
  |                  x         |     |     snd ACK
  |                            V     V
  |  CLOSE                   +---------+
  | -------                  |  ESTAB  |
  | snd FIN                  +---------+
  |                   CLOSE    |     |    rcv FIN
  V                  -------   |     |    -------
+---------+          snd FIN  /       \   snd ACK          +---------+
|  FIN    |<-----------------           ------------------>|  CLOSE  |
| WAIT-1  |------------------                              |   WAIT  |
+---------+          rcv FIN  \                            +---------+
  | rcv ACK of FIN   -------   |                            CLOSE  |
  | --------------   snd ACK   |                           ------- |
  V        x                   V                           snd FIN V
+---------+                  +---------+                   +---------+
|FINWAIT-2|                  | CLOSING |                   | LAST-ACK|
+---------+                  +---------+                   +---------+
  |                rcv ACK of FIN |                 rcv ACK of FIN |
  |  rcv FIN       -------------- |    Timeout=2MSL -------------- |
  |  -------              x       V    ------------        x       V
   \ snd ACK                 +---------+delete TCB         +---------+
    ------------------------>|TIME WAIT|------------------>| CLOSED  |
                             +---------+                   +---------+

                     TCP Connection State Diagram
                              Figure 6.
							  

A connection progresses through a series of states during its
lifetime.  The states are:  LISTEN, SYN-SENT, SYN-RECEIVED,
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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值