Skip to content

TCP Sequence and Acknowledgement Numbers Explained

TCP Sequence (seq) and Acknowledgement (ack) numbers help enable ordered reliable data transfer for TCP streams.  The seq number is sent by the TCP client, indicating how much data has been sent for the session (also known as the byte-order number). The ack number is sent by the TCP server, indicating that is has received cumulated data and is ready for the next segment.

The TCP seq and ack numbers are coordinated with one another and are key values during the TCP handshake, TCP close, and, of course, while data is transferred between the client and server.

[By default, Wireshark converts all sequence and acknowledgement numbers into relative numbers. This means that all SEQ and ACK numbers always start at 0 for the first packet seen in each conversation.]

The picture below shows a real example of TCP sequence and acknowledgment numbers in a TCP flow diagram. The key variable is the TCP segment length for each TCP segment sent in the session.

The client sends the first segment with seq=1 and the length of the segment is 669 bytes.  The server responds with an ack=670 which tells the client that the next expected segment will have a sequence number is 670.

The next segment the client sends has seq=670 and the len is now 1460 bytes.  In turn,  the server responds with ack=2130 (670 + 1460).  This cycle continues until the end of the TCP session.

Again, note that the length value is from the TCP segment length, not the Layer 2 frame length nor the IP packet length.

Seq and Ack in Wireshark

Client sends seq=1 and tcp segment length=669

Server responds with ack=670

Client sends segment with seq=670 and length=1460

Server responds with ack=2130

 

This is just a simple example to get the basics of TCP sequence and acknowledgement numbers.

 

 

 

 

 

3 thoughts on “TCP Sequence and Acknowledgement Numbers Explained Leave a comment

  1. benarbia farouk adel says:

    thnx bro this lesson is very helpful !!

  2. Anonymous says:

    nice bro thx so much

  3. Anonymous says:

    Excellent

Leave a Reply

%d