0% found this document useful (0 votes)
8 views

Lecture 16-TCP Segment Structure

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lecture 16-TCP Segment Structure

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Lecture 16:TCP Segment Structure

Lecture 16
TCP Segment Structure
Lecture 16:TCP Segment Structure
TCP: Overview RFCs: 793,1122,1323, 2018,
2581

• point-to-point: • full duplex data:


– one sender, one – bi-directional data flow in
receiver same connection
• reliable, in-order byte – MSS: maximum segment
stream: size
– no “message • connection-oriented:
boundaries” – handshaking (exchange
• pipelined: of control msgs) inits
sender, receiver state
– TCP congestion and
before data exchange
flow control set window
size • flow controlled:
– sender will not overwhelm
receiver
Transport Layer 3-2
Lecture 16:TCP Segment Structure

MSS and MTU

• The maximum amount of data in a segment is


limited by the maximum segment size (MSS).
• The MSS is typically set by first determining (the
so-called maximum transmission unit, MTU)

• MSS+ TCP/IP header when encapsulated in an


IP datagram) will fit into a single link-layer frame.
Lecture 16:TCP Segment Structure

TCP Send/Receive buffers


Lecture 16:TCP Segment Structure

TCP connection

• TCP connection consists of


– Buffers and variables
– a socket connection to a process in one host, and
another set of buffers, variables, and a socket
connection to a process in another host.

• Nothing is stored in the network elements


(routers, switches, and repeaters) between the
hosts.
Lecture 16:TCP Segment Structure
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not U A P R S F
PSH: push data now len used
receive window
(generally not used) # bytes
checksum Urg data pointer
rcvr willing
RST, SYN, FIN: to accept
options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)

Transport Layer 3-6


Lecture 16:TCP Segment Structure

Sequence Numbers

• TCP views data as an unstructured, but


ordered, stream of bytes.

• Sequence numbers are over the stream of


transmitted bytes and not over the series
of transmitted segments.
Lecture 16:TCP Segment Structure

TCP Sequence Numbers

• The sequence number for a segment is


therefore the byte-stream number of the
first byte in the segment.
Lecture 16:TCP Segment Structure

An example

• A process in Host A wants to send a stream of


data to a process in Host B.

• The TCP in Host A will implicitly number each


byte in the data stream.
– For a file consisting of 500,000 bytes,
– MSS being 1,000 bytes, and that the first byte of the
data stream is numbered 0.
– TCP constructs 500 segments out of the data stream.
Lecture 16:TCP Segment Structure

TCP Sequence Numbers

The first segment gets assigned sequence number 0, the second segment gets

assigned sequence number 1,000, the third segment gets assigned sequence

number 2,000, and so on.


Lecture 16:TCP Segment Structure

Acknowledgment numbers

• TCP is full-duplex, so that Host A may be


receiving data from Host B while it sends data to
Host B (as part of the same TCP connection).

Data for B

A Data for A ACK B

ACK
Lecture 16:TCP Segment Structure

Acknowledgment numbers

• A sends a segment to B, what would B put in the


ACK number in the next segment it sends to A?
– next byte Host B is expecting from Host A.

• A sends a segment to B, what would A put in the


ACK number in the next segment it sends to B?
– next byte Host A is expecting from Host B.
Lecture 16:TCP Segment Structure

An example

• Host A has received all bytes numbered 0


through 535 from B.
• Host A is waiting for byte 536 and all the
subsequent bytes in Host B’s data stream.

• What does Host A put in the acknowledgment


number field of the next segment it sends to B?
Lecture 16:TCP Segment Structure

Another example

• Host A has received all bytes numbered 0


through 535 from B.
• Host A has also received another segment
containing bytes 900 through 1,000
– For some reason Host A has not yet received bytes
536 through 899.

• What does Host A put in the acknowledgment


number field of the next segment it sends to B?
Lecture 16:TCP Segment Structure

Out of order segments

• TCP only acknowledges bytes up to the first


missing byte in the stream, TCP is said to
provide cumulative acknowledgments.

• For out of order segments it can either discard


them or buffer them (the approach actually taken
in practice)
Lecture 16:TCP Segment Structure

The seg/ack numbers base

• we assumed that the initial sequence


number was zero.
• In truth, both sides of a TCP connection
randomly choose an initial sequence
number.

• Why?
Lecture 16:TCP Segment Structure
TCP seq. numbers, ACKs
Host A Host B

User
types
‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80

simple telnet scenario

Transport Layer 3-17


Lecture 16:TCP Segment Structure

Computer Networking: A Top Down Approach


6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

A note on the origin of these ppt slides:


These slides are freely provided by the book authors and it represents a lot of work on their part.
We would like to thank J.F Kurose and K.W. Ross.

You might also like