Networking‎ > ‎


TCP Packet Format
The segment consists of a 20 - 60 bytes header, followed by data.
 S.No.Field  Size (bits) Description
 1 Source Port Address 16 Port number of the Sender.
 Destination Port Address16 Port number of the Receiver.
 Sequence Number32 The number assigned to the first byte of the data contained in this segment.
During connection establishment, random number generator creates an initial sequence number (ISN).
If ISN is 2367, and first segment carry 1000 bytes, the sequence number is 2369 (2367 and 2368 are used for connection establishment)

 Acknowledgement Number 32 The byte number receiver expects to receive from the other party. If the receiver has received all bytes upto x, x+1 is the acknowledgement number. 
 Header Length 4Number of 4-byte word in the TCP header. For 20 bytes header, it is 5.
6     Reserved  
 Control It defined 6 different control or flags.
 Window Size 16 Size of window for other party. 
 Checksum 16  
10  Urgent Pointer 16 Valid if urgent flag is set.
Number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment.
11  Options Upto 40  

The inclusion of checksum in TCP is mandatory. The checksum is calculated using pseudoheader.