Please Whitelist This Site?
I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)
If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.
If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.
Thanks for your understanding!
Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide
|
NOTE: Using software to mass-download the site degrades the server and is prohibited. If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.
|
|
|
|
TCP Connection Establishment Process: The "Three-Way Handshake"
(Page 4 of 4)
Simultaneous Open Connection Establishment
TCP is also set up to handle the
situation where both devices perform an active OPEN instead of
one doing a passive OPEN. This may occur if two clients are trying
to reach each other instead of a client and a server. It is uncommon,
however, and only happens under certain circumstances.Simultaneous connection
establishment can also only happen if a well-known port is used as the
source port for one of the devices.
In this case, the steps are different
for both devices. Each client will perform an active OPEN and
then proceed through both the SYN-SENT and SYN-RECEIVED
states until their SYNs are acknowledged. This means there isn't
a three-way handshake any more as shown in Table 152.
Instead, it is like two simultaneous two-way handshakes.
Each client sends a SYN, receives the other's SYN and
ACKs it, and then waits for its own ACK. The transaction,
simplified, is described in Table 153
and Figure 212.
Table 153: TCP Simultaneous Open Connection Establishment Procedure
Client
A
|
Client
B
|
Start
State
|
Action
|
Move To
State
|
Start
State
|
Action
|
Move To
State
|
CLOSED
|
Client A Step #1 Transmit:
Client A performs an active OPEN, creating a TCB and sending
a SYN message to the server.
|
SYN-SENT
|
CLOSED
|
Client B Step #1 Transmit:
Client B performs an active OPEN, creating a TCB and sending
a SYN to the server.
|
SYN-SENT
|
SYN-SENT
|
Client B
Step #1 Receive and Step #2 Transmit: Client A receives Client
B's SYN and sends it an ACK. It is still waiting
for an ACK to its own SYN.
|
SYN-RECEIVED
|
SYN-SENT
|
Client A
Step #1 Receive and Step #2 Transmit: Client B receives Client
A's SYN and sends it an ACK. It is still waiting
for an ACK to its own SYN.
|
SYN-RECEIVED
|
SYN-RECEIVED
|
Client A Step #2 Receive:
Client A receives the ACK from Client B for its
SYN and is done with connection establishment.
|
ESTABLISHED
|
SYN-RECEIVED
|
Client B Step #2 Receive:
Client B receives the ACK from Client A for its
SYN and is done with connection establishment.
|
ESTABLISHED
|
Figure 212: TCP Simultaneous Open Connection Establishment Procedure This diagram shows what happens when two devices try to open a connection to each other at the same time. In this case instead of a three-way handshake, each sends a SYN and receives an ACK. They each follow the same sequence of states, which differs from both sequences in the normal three-way handshake.
|
To keep the table size
down, I have shown the activities performed by the two devices occurring
simultaneously (in the same row). In real life the actions
dont need to occur at exactly the same time, and probably wont.
All that has to happen for the simultaneous procedure to be followed
is that each device receives a SYN before getting an ACK for their own
SYN, as Figure 212
shows.
Key Concept: If one device setting up a TCP connection sends a SYN and then receives a SYN from the other one before its SYN is acknowledged, the two devices perform a simultaneous open, which consists of the exchange of two independent SYN and ACK message sets. The end result is the same as the conventional three-way handshake, but the process of getting to the ESTABLISHED state is different. |
If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support! |
|
|
Home -
Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.
|