Title: TCP segment structure
1TCP segment structure
32 bits
URG urgent data (generally not used)
counting by bytes of data (not segments!)
source port
dest port
sequence number
ACK ACK valid
acknowledgement number
head len
not used
rcvr window size
S
R
P
A
U
F
PSH push data now (generally not used)
bytes rcvr willing to accept
checksum
ptr urgent data
RST, SYN, FIN connection establish (setup,
teardown commands)
options (variable length)
application data (variable length)
Internet checksum (as in UDP)
2Establish Connection
Host A
Host B
SYN, Seq_no x
SYN, Seq_no y, ACK, Ack_no x1
Seq_no x1, ACK, Ack_no y1
Figure 8.22
3Establish Connection Problem of Delayed Segment
Host A
Host B
SYN, Seq_no n
SYN, Seq_no n, ACK, Ack_no n1
Seq_no n1, ACK, Ack_no n1
Delayed segment with
Seq_no n2
will be accepted
Figure 8.23
4Data Transfer
Host B (Server)
Host A (Client)
socket bind listen accept (blocks)
socket connect (blocks)
SYN, Seq_no x
SYN, Seq_no y, ACK, Ack_no x1
connect returns
Seq_no x1, ACK, Ack_no y1
write read (blocks)
accept returns read (blocks)
request message
read returns
write read (blocks)
reply message
read returns
Figure 8.24
5Data Transfer (2)
Host A
Host B
t0
Seq_no 1, Ack_no 2000, Win 2048, No Data
t1
Seq_no 2000, Ack_no 1, Win 1024, Data
2000-3023
t2
Seq_no 3024, Ack_no 1, Win 1024, Data
3024-4047
t3
Seq_no 1, Ack_no 4048, Win 512, Data 1-128
t4
Seq_no 4048, Ack_no 129, Win 1024, Data
4048-4559
Figure 8.25
6Connection Teardown
Host A
Host B
FIN, seq 5086
ACK 5087
Data, seq. 303, ACK 5087
Deliver 150 bytes
ACK 453
FIN, seq. 453, ACK 5087
ACK 454
Figure 8.27