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 Sequence Number Synchronization and Parameter Exchange
(Page 2 of 3)
TCP Sequence Number Synchronization
Once each device has chosen its ISN,
it sends this value to the other device in the Sequence Number
field in its initial SYN message. The device receiving the SYN
responds with an ACK message acknowledging the SYN (which
may also contain its own SYN, as in step #2 of the three-way
handshake). In the ACK message, the Acknowledgment Number
field is set to the value of the ISN received from the other device
plus one. This represents the next sequence number the
device expects to receive from its peer; the ISN actually thus represents
the sequence number of the last byte received (fictitious in this case,
since the connection is new and nothing yet has been received). We'll
see later on that this
is consistent with how these two fields are used for normal data exchange.
Key Concept: As part of the process of connection establishment, each of the two devices in a TCP connection informs the other of the sequence number it plans to use for its first data transmission by putting the preceding sequence number in the Sequence Number field of its SYN message. The other device confirms this by incrementing that value and putting it into the Acknowledgment Number field of its ACK, telling the other device that is the sequence number it is expecting for the first data transmission. This process is called sequence number synchronization.
Here's a simplified example of the
three-way handshake steps showing how this is done (see Figure 213
as well). I chose small ISNs for readability but remember that they
can be any 32-bit number:
- Connection Request By Client:
The client chooses an ISN for its transmissions of 4,567. It sends a
SYN with the Sequence Number field set to 4,567.
- Acknowledgment and Connection Request
By Server: The server chooses an ISN for its transmissions of 12,998.
It receives the client's SYN. It sends a SYN+ACK with
an Acknowledgment Number field value of 4,568 (one more than
the client's ISN). This message has a Sequence Number field value
- Acknowledgment By Client: The
client sends an ACK with the Acknowledgment Number field
set to 12,999.
Figure 213: TCP Sequence Number Synchronization
This diagram illustrates the same three-way handshake connection establishment procedure introduced in Figure 211, except this time I have shown the Sequence Number and Acknowledgment Number fields in each message so you can see how they are used by each of the two devices to establish initial sequence numbers for data exchange.
With the connection now established,
the client will send data whose first byte will be given sequence number
4,568. The server's first byte of data will be numbered 12,999.
|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!|
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.