Post on 17-Jul-2016
description
TCP Segment
TCP segment
TCP Segment
Telematics EngineeringUniversitat Politecnica de Catalunya (UPC)
1/17
TCP Segment
TCP segment
Outline
1 TCP segment
2/17
TCP Segment
TCP segment
TCP Segment I
• It is the PDU (Protocol Data Unit) in TCP applications.• Used in:
• Connections establishment / release.• Data transfer.• Data recognition.• Window size announcement...
3/17
TCP Segment
TCP segment
TCP Segment II
4/17
TCP Segment
TCP segment
Ports
TCP Socket: IPs,Ps,IPd,PdMux/Demux
5/17
TCP Segment
TCP segment
Window
TCP provides an end to end Sliding-Window like flowcontrol (explained below).
6/17
TCP Segment
TCP segment
Sequence Numbers I
7/17
TCP Segment
TCP segment
Sequence Numbers II
• Sequence numbers of 32 bits.
• TCP transmits the byte stream splited into segments.
• Each byte of the flow is identified by a unique sequencenumber.
• This number is reused cyclically (wrap around).
• Sequence numbers refer to bytes in ”flight“.
8/17
TCP Segment
TCP segment
Sequence Numbers III
• The sequence number of the first flow’s byte israndomly chosen at the start of the connection (InitialSequence Number).
• In the following segments, reveals the first packed byteinto the byte stream.
• In ACKs indicates the next byte that is expected to bereceived.
• TCP generates a RESET when an impossiblesequence number is received.
9/17
TCP Segment
TCP segment
Other Fields I
10/17
TCP Segment
TCP segment
Other Fields II
• Header Length in 32 bits word.• The header size is variable as it may contain options.
• Code Bits (6 bits):• SYN: Synchronism. Indicates the start of the
connection.• FIN: Reveals the end of the connection.• RST: Reset of the connection.• PSH: Force the delivery of information.• ACK: Valid recognition field.• URG: Valid urgent pointer field.
• Urgent Data Pointer: position where urgent data ends.
11/17
TCP Segment
TCP segment
Urgent Mode
• It provides a way to send ”offtopic“ data.• Another parallel flow (the flow ”urgent“).• To do so:
• An end can mark the data as urgent.• TCP must notify to the receiver process, and the
application must make sense of it.
12/17
TCP Segment
TCP segment
Checksum I
13/17
TCP Segment
TCP segment
Checksum II
• UDP like.• However, in this case, the checksum is mandatory.• Check the integrity of TCP data, header and
pseudo-header taking keeping in mind:
• Protection against faulty segments due to routingerrors.
14/17
TCP Segment
TCP segment
Options
15/17
TCP Segment
TCP segment
MSS Option
• MSS (Maximum Segment Size)• Aims to inform the other end of the maximum Bytes a
TCP segment can contain.• This option can be sent within the SYN segment. Why
MSS? Efficiency!• Small Packets:
• Inefficiency.• Large Packages:
• Fragmentation.• The loss of fragment implies the retransmission of the
entire segment.
16/17
TCP Segment
TCP segment
Timestamp Option
• Allows the transmitter to include time reference in eachsegment.
• The receiver echoes the timestamp.• By this option, the sender can estimate the segment
round trip time (RTT).• Very useful in precise timeout estimation.
17/17