📄 rfc916.txt
字号:
is a slightly more detailed look at the allowed transitions which occur between states. Finally a detailed discussion of the behavior of each state is given. 5.1. Protocol States The states used to describe this protocol are: LISTEN This state represents waiting for a connection from the other end of the link. SYN-SENT This represents waiting for a matching connection request after having sent a connection request. SYN-RECEIVED This represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.Finn [Page 20]RFC 916 October 1984Reliable Asynchronous Transfer Protocol ESTABLISHED This state represents a connection fully opened at both ends. This is the normal state for data transfer. FIN-WAIT In this state one is waiting for a connection termination request from the other end of the connection and an acknowledgment of a termination request previously sent. LAST-ACK This end of the connection has seen and acknowledged a termination request from the other end. This end has responded with a termination request of its own and is now expecting an acknowledgment of that request. CLOSING This represents waiting for an acknowledgment of a connection termination request. TIME-WAIT This represents waiting for enough time to pass to be sure that the other end of the connection received the acknowledgment of its termination request. CLOSED A fictional state which represents a completely terminated connection. If either end of a connection is in this state it will neither send nor receive data or control packets.Finn [Page 21]RFC 916 October 1984Reliable Asynchronous Transfer Protocol 5.2. State Transitions This section describes events which cause the protocol to depart from its current state. A brief mention of each state is accompanied by a list of departure events and to which state the protocol goes as a result of those events. Departures due to the presence of a RST flag are not shown. 5.2.1. LISTEN This is a request to listen for any connection from the other end of the link. In this state, no packets are sent. The connection may be thought of as half-open. A STATUS request will return to the caller this information. Arrived at from the CLOSED state in response to a passive OPEN. In a passive OPEN no packets are sent, the interface is waiting for the initiation of a connection from the other end of the link. Also this state can be reached in certain cases in response to an RST connection reset request. Departures - A CLOSE request is made by the user. Delete the half-open TCB and go to the CLOSED state. - A packet arrives with the SYN flag set. Retrieve the sender's MDL he placed into the LENGTH field. Set AN to be received SN+1 modulo 2. Build a response packet with SYN, ACK set. Choose your MDL and place it into the LENGTH octet. Choose your initial SN, place in AN. Send this packet and go to the SYN-RECEIVED state. 5.2.2. SYN-SENT Arrived at from the CLOSED state in response to a user's active OPEN request. Departures - A CLOSE request is made by the user. Delete the TCB and go to the CLOSED state. - A packet arrives with the SYN flag set. Retrieve the sender's MDL he placed into the LENGTH field. Set AN toFinn [Page 22]RFC 916 October 1984Reliable Asynchronous Transfer Protocol be received SN+1 modulo 2. Build a response packet with ACK set, place in AN. Send this packet and go to the SYN-RECEIVED state. - A packet arrives with the SYN, ACK flags set. Retrieve the sender's MDL he placed into the LENGTH field. Set AN to be received SN+1 modulo 2. Build a response packet with ACK set. Set SN to be SN+1 modulo 2, place SN and AN into the header. Remembering the other end's MDL, build data portion of packet. Send this packet and go to the ESTABLISHED state. 5.2.3. SYN-RECEIVED Arrived at from the LISTEN and SYN-SENT states in response to an arriving SYN packet. Departures - A CLOSE request is made by the user. Create a packet with FIN set. Send it and go to the FIN-WAIT state. - A packet arrives with the ACK flag set. This packet acknowledges a previous SYN packet. Go to the ESTABLISHED state. The TCB should now note the connection is fully opened. - A packet arrives with the FIN flag set. The other end has decided to close the connection. Create a packet with FIN, ACK set. Send it and go to the LAST-ACK state. 5.2.4. ESTABLISHED This state is the normal state for a connection. Data packets may be exchanged in both directions (MDL allowing). It is arrived at from the SYN-RECEIVED and SYN-SENT states in response to the completion of connection initiation. Departures - In response to a CLOSE request from the user. Set AN to be most recently received SN+1 modulo 2. Build a packet with FIN set. Set SN to be SN+1 modulo 2, place SN and AN into the header and send the packet. Go to the FIN-WAIT state. - A packet containing a FIN is received. Set AN to beFinn [Page 23]RFC 916 October 1984Reliable Asynchronous Transfer Protocol received SN+1 modulo 2. Build a response packet with both FIN and ACK set. Set SN to be SN+1 modulo 2, place SN and AN into the header. No data portion is built. Send this packet and go to the LAST-ACK state. 5.2.5. FIN-WAIT Arrived at from either the SYN-RECEIVED state or from the ESTABLISHED state. In both cases the user had requested a CLOSE of the connection and a packet with a FIN was sent. Departures - A FIN, ACK packet is received which acknowledges the FIN just sent. Go to the TIME-WAIT state. - A FIN packet is received which indicates the other end of the connection has simultaneously decided to close. Set AN=received SN+1 modulo 2, and SN=SN+1 modulo 2. Send a response packet with the ACK set. Go to the CLOSING state. 5.2.6. LAST-ACK Arrived at from the ESTABLISHED and SYN-RECEIVED states. Departures - An ACK is received for the last packet sent which was a FIN. Delete the TCB and go to the CLOSED state. 5.2.7. CLOSING Arrived at from the FIN-WAIT state. Departures - An ACK is received for the last packet sent which was a FIN. Go to the TIME-WAIT state. 5.2.8. TIME-WAIT Arrived at from the FIN-WAIT and CLOSING states.Finn [Page 24]RFC 916 October 1984Reliable Asynchronous Transfer Protocol Departures - This states waits until 2*SRTT time has passed. It then deletes the TCB associated with the connection and goes to the CLOSED state. 5.2.9. CLOSED This state can be arrived at for a number of reasons: 1) while in the LISTEN state the user requests a CLOSE, 2) while in the SYN-SENT state the user requests a CLOSE, 3) while in the TIME-WAIT state the 2*SRTT time period has elapsed, and 4) while in the LAST-ACK state an arriving packet has an ACK of the previously sent FIN packet. In this state no data is read or sent over the link. To leave this state requires an outside request to open a new connection. Departures - User requests an active OPEN. Create a packet with SYN set. Choose your MDL and place it into the LENGTH octet. Choose your initial SN. AN is immaterial. Send this packet and go to the SYN-SENT state. The TCB for this connection is created. The connection may be thought of as half-open. A STATUS request will return to the caller this information. - User requests a passive OPEN. The TCB for this connection is created. The connection may be thought of as half-open. A STATUS request will return to the caller this information. Go to the LISTEN state.Finn [Page 25]RFC 916 October 1984Reliable Asynchronous Transfer Protocol 5.3. State Behavior This section discusses in detail the behavior of each state in response to the arrival of a packet. In what follows a packet is not considered to have arrived until it has passed a number of tests (see the chapter entitled: Packet Reception). The method chosen to describe state behavior is tabular. Each state is listed opposite a sequence of named procedures to execute whenever a packet has arrived. STATE BEHAVIOR =============+======================== LISTEN | A -------------+------------------------ SYN-SENT | B -------------+------------------------ SYN-RECEIVED | C1 D1 E F1 H1 -------------+------------------------ ESTABLISHED | C2 D2 E F2 H2 I1 -------------+------------------------ FIN-WAIT | C2 D2 E F3 H3 -------------+------------------------ LAST-ACK | C2 D3 E F3 H4 -------------+------------------------ CLOSING | C2 D3 E F3 H5 -------------+------------------------ TIME-WAIT | D3 E F3 H6 -------------+------------------------ CLOSED | G -------------+------------------------ For example, in the ESTABLISHED state the arrival of a packet causes procedure C2 to be executed, then D2, then E, F2, H2, and finally I1. Any procedure may terminate the processing which occurs or cause a state change. Note that these procedures are executed in sequence, first C2, then D2, etc. The time ordering cannot be mixed. The particular actions associated with each procedure are now described.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -