Ads Here

Sunday, January 28, 2018

SEGMENT

SEGMENT

A packet in TCP is called a segment. 

Format:


The segment consist of a header of 20 to 60 bytes, followed by data from the application program.

The header is 20 bytes if there are no option and up to 60 bytes if it contains options. 

Source port address:

This is a 16 bit field that defines the source port number.

Destination port address:

This is 16 bit field that defines the destination port number.


Sequence number: 

This is 32-bit defines the number assigned to the first byte of data contained in this segment.  

Acknowledgement number:

This is 32-bit field defines the byte number that the receiver of the segment is expected to receive from other party. 

If the receiver of the segment has successfully received byte number x from the other party, it return x+1 as the acknowledgement number. 

Acknowledgement and data can be piggybacked together. 

Header length:

This is 4-bit field indicates the length of header, which is in between 20 to 60 bytes. The value of this filed is always between 5(5x4=20) and 15(15x4=60).

Reserved:

This is 6-bit field reserved for future use.

Control:

This field define 6 different control bits/flags.
These bits can be set to enable flow control,connection establishment and termination,connection abortion, and the mode of data transfer in TCP.

URG: Urgent pointer is valid
ACK: Acknowledgment is valid
PSH: Request for push
RST: Reset the connection
SYN: Synchronize sequence numbers
FIN: Terminate the connection

Window Size: 

This field defines the window size of the sending TCP in bytes. 
The length of  this field is 16bits, which means that the maximum size of window is 65,535 bytes. 

Checksum:

This 16-bit field contains the checksum. 

Urgent pointer:

This is 16-bit field, which is valid only if the urgent flag is set. 
It is used when the segment contains urgent data. 

Options:

There can be up to 40 bytes of optional information in the TCP header.

Which includes
  • Maximum Segment Size (MSS): The Maximum Segment Size is used to define the maximum segment that will be used during a connection between two hosts.
  • Window Scaling: Window Scaling is, in essence, an extention to the Window size flag. Because the largest possible value in the Window size flag is only 65,535 bytes (64 kb), it was clear that a larger field was required in order to increase the value to a whopping 1 Gig! Thus, Window Scaling was born. The Window Scaling option can be a maximum of 30 bits in size, which includes the original 16 bit Window size field covered in the previous section. So that's 16 (original window field) + 14 (TCP Options 'Window Scaling') = 30 bits in total.
  • Selective Acknowledgements (SACK): A SACK reports a block of data that is out of order, and also a block of segments that is duplicated, i.e. received more than once. However, since there is no provision in the TCP header for adding this type of information, SACK is implemented as an option at the
    end of the TCP header.
  • Timestamps: he Timestamp field consists of a Timestamp Echo and Timestamp Reply field.
  • Nop:The nop TCP Option means "No Option" and is used to separate the different options used within the TCP Option field. The implementation of the nop field depends on the operating system used.
Click Here for more details study of TCP Option







No comments:

Post a Comment