Terminology
Numbers
Sequence Number: 32 bits
The sequence number of the first data octet in this segment (except
when SYN is present). If SYN is present the sequence number is the
initial sequence number (ISN) and the first data octet is ISN+1.
Acknowledgment Number: 32 bits
If the ACK control bit is set this field contains the value of the
next sequence number the sender of the segment is expecting to
receive. Once a connection is established this is always sent.
Current Segment Variables
SEG.SEQ segment sequence number
SEG.ACK segment acknowledgment number
SEG.LEN segment length
SEG.WND segment window
SEG.UP segment urgent pointer
SEG.PRC segment precedence value
Sequence and Acknowledgement Numbers
First packet (sent by client):
SEG.SEQ = x # assigned sequence number for the SYN virtual octet
SEG.ACK = 0
Second packet (sent by server):
SEG.SEQ = y # assigned sequence number for the SYN virtual octet
SEG.ACK = x+1 # the next sequence number expected to receive, which is the data octect after SYN. relative sequence number in Wireshark is actual number minus `x`, and in this segment is 1.
Third packet (sent by client):
SEG.SEQ = x+1 # assigned sequence number for the SYN virtual octet
SEG.ACK = y+1 # the next sequence number expected to receive from the server
SEG.LEN = 0
Next packet sent does not need to wait for acknowledgment of the third packet.
Fourth packet (sent by client):
SEG.SEQ = x+1 # assigned sequence number for the SYN virtual octet
SEG.ACK = y+1 # the next sequence number expected to receive from the server
SEG.LEN = 4 # calculated by deducting Data Offset (header length in Wireshark) from TCP segment size, not on wire
The fourth packet usually have PSH
bit set to reduce latency.