|
||||||||||||||
| ISBN: 3423050012 ISBN: 3423050012 ISBN: 3423050012 ISBN: 3423050012 | ||||||||||||||
|
Wir empfehlen: | |||||||||||||
3. The Opening and Closing of a Connection 3.1. Opening a Connection A "three-way handshake" is the procedure used to establish a connection. It is normally initiated by one end of the connection and responded to by the other. It will still work if both sides simultaneously initiate the procedure. Experience has shown that this strategy of opening a connection reduces the probability of false connections to an acceptably low level. The simplest form of the three-way handshake is illustrated in the diagram below. The time order is line by line from top to bottom with certain lines numbered for reference. User events are placed in brackets as in [OPEN]. An arrow (-->) represents the direction of flow of a packet and an ellipsis (...) indicates a packet in transit. Side A and side B are the two ends of the connection. An "XXX" indicates a packet which is lost or rejected. The contents of the packet are shown on the center of each line. The state of both connections is that caused by the departure or arrival of the packet represented on the line. The contents of the data portion of a packet are left out for clarity. Side A Side B 1. CLOSED LISTEN 2. [OPEN request] 3. --> SYN-RECEIVED 4. ESTABLISHED <-- 5. --> ESTABLISHED
In line 3 side B has just received the SYN packet from A. This places B in the SYN-RECEIVED state. B now sends a SYN packet to A which acknowledges the SYN it just received from A. Note that the AN field indicates B is now expecting to hear SN=1, thus acknowledging the SYN packet from A which used SN=0. B also specifies in the LENGTH field the largest number of data octets it is prepared to consume. Side A receives the SYN packet from B which acknowledges A's original SYN packet in line 4. This places A in the ESTABLISHED state. Side A can now be confident that B expects to receive more packets from A. A is now free to send B the first DATA packet. In line 5 upon receipt of this packet side B is placed into the ESTABLISHED state. DATA cannot be sent until the sender is in the ESTABLISHED state. This is because the LENGTH field is used to specify the MDL when opening the connection. 3.2. Recovering from a Simultaneous Active OPEN It is of course possible that both ends of a connection may choose to perform an active OPEN simultaneously. In this case neither end of the connection is in the LISTEN state, both send SYN packets. A reliable bidirectional protocol must recover from this situation. It should recover in such a manner that the connection is successfully initiated. Side A Side B 1. CLOSED CLOSED 2. [OPEN request] SYN-SENT --> <SN=0><CTL=SYN><MDL=n> ... 3. ... [OPEN request] <SN=0><CTL=SYN><MDL=m> <-- SYN-SENT 4. --> SYN-RECEIVED ... <SN=0><AN=1><CTL=SYN,ACK><MDL=m> <-- 5. (packet finally arrives) SYN-RECEIVED <-- <SN=0><CTL=SYN><MDL=m> --> <SN=0><AN=1><CTL=SYN,ACK><MDL=n> --> ESTABLISHED ... <SN=1><AN=1><CTL=ACK> <-- 6. (packet finally arrives) ESTABLISHED <-- <SN=0><AN=1><CTL=SYN,ACK><MDL=m> --> <SN=1><AN=1><CTL=ACK> ... During simultaneous connection both sides of the connection cycle from the CLOSED state through SYN-SENT to SYN-RECEIVED, and finally to ESTABLISHED. 3.3. Detecting a Half-Open Connection Any computer may crash after a connection has been established. After recovering from the crash it may attempt to open a new connection. The other end must be able to detect this condition and treat it as an error. 1. ESTABLISHED ESTABLISHED --> <SN=0><AN=1><CTL=ACK><DATA> ... --> (crashes) 2. XXX <SN=1><AN=1><CTL=ACK><DATA> <-- 3. (attempts to open new connection ) --> <SN=0><CTL=SYN><MDL=m> --> ... <SN=0><AN=1><CTL=RST,ACK> <-- (abort) CLOSED 4. <-- (connection refused) CLOSED |
||||||||||||||
| |<< Anfang < Zurück Index Weiter > Ende >>| | ||||||||||||||
|
Zurück zur Themenseite: ScientificPublication.com/Startseite/Informatik/Spezifikationen Das Setzen von Verweisen (Links) auf diese Seite ist gestattet und bedarf keine vorherige Absprache. Artikelliste: Realible Asynchronous Transfer Protocol | ||||||||||||||
| Startseite | english | Bookmark setzen | Webseite weiterempfehlen | Impressum | ||||||||||||||