Saturday 29 June 2013

TCP Header

 The Transmission Control Protocol (TCP) header is the first 24 bytes of a TCP segment that contains the parameters and state of an end-to-end TCP socket. The TCP header is used to track the state of communication between two TCP endpoints. Since TCP segments are inserted (encapsulated) in the payload of the IP packet the TCP header immediately follows the IP header during transmission. TCP does not need to keep track of which systems are communicating, it only needs to track which end to end sockets are currently open. Internet Protocol handles the logical addressing, routing and host-to-host connectivity.

TCP uses port numbers on each side of the connection to track the connection endpoints, state bits such as SYN, ACK, RST, FIN, sequence numbers and acknowledgement numbers to track the communication at each step in transmission.
An example of a TCP header is shown below.
 
Source Port
(0 - 65535)
Destination Port
(0 - 65535)

Sequence Number
(0 - 4294967295)
Acknowledgement Number
(0 - 4294967295)
Data
Offset
Reserved U
R
G
A
C
K
P
S
H
R
S
T
S
Y
N
F
I
N
Window
Checksum
(CRC-Check)
Urgent Pointer
Options Padding
Data


Field Bits Usage
 Source Port 16  Communication source point
 Destination Port 16  Communication end point
 Sequence Number 32 Used for segmentation and reassembly of TCP segments.
 Data Offset   Indicates number of bytes into segment where data can be found (number of bytes in the TCP header)
 Reserved    
 URG - Urgent Flag 1
 
 ACK - Acknowledgement Flag 1 Used during 3-way handshake and data transfers.
 PSH - Push Flag 1 Used for TCP data push
 RST - Reset Flag 1 Used to reset a TCP connection
 SYN - Synchronize Flag 1 Used during 3-way handshake
 FIN - End of data 1 Indicates end of the TCP session
 Window 16 Number of octets in the TCP header
 Checksum 16  
 Urgent Pointer 16  
 Options Varies  
 Padding Varies  

No comments:

Post a Comment