TCP and UDP headers: All you need to know

Hey there, welcome to our blog hope you are doing good. In this blog, I'm going to discuss UDP and TCP headers.

Let's start,

Just a line about what a header is, 

In a network transmission, a header is part of the data packet and contains transparent information about the file or the transmission.

UDP header 


UDP header is simple consists of source port number  destination port number  and UDP header +data and UDP checksum finally application data if any                                                               

 The Source port layer is the 1st layer in the UDP header, and it's a 16-bit field, and it identifies the port of the sending application as the destination port in the UDP header. It's a 16-bit destination port, and it also identifies the port of the receiving application.


secondly,

UDP header is of length 16 bit.it identifies the size of the UDP header and data the in UDP is the checksum, and it's 16bit in size calculated in UDP header; the checksum is not mandatory in UDP header; as a result, there may be a corruption of data during transmission


Data will be present in the last layer of the UDP header.


UDP headers are limited to 8 bytes. Theoretically, the field size limit of a UDP datagram is 65,535 that is (8 bytes (header) + 65,527)


TCP header



TCP has many layers compared to UDP datagram UDP, using TCP is more advantageous than using UDP TCP is connection-oriented and have data recovery features(retransmission of lost data)

from top to bottom in the image,

layer 1 is a 16-bit source port (port number of the sender) and 16-bit destination port (port number of the receiver), same as UDP total of 32 bits 

layer 2 contain a 16-bit sequence number that indicates how much data is sent through the TCP session

If syn is set, then sequence number is actual sequence number plus 1; if syn is not specified, the actual sequence number is the accumulated sequence number, the length of the sequence number is random, and of 32-bit size

In layer 3, the receiver uses the acknowledgment number to request the next TCP segment ACK be set. The acknowledge number value is equal to the following sequence number that the receiver is expecting to receive.



in the 4th layer,

header length minimum header length is 5 words, the minimum header length is 20 bytes. The maximum header length is 15 words, the maximum size of the header is 60 bytes.

Next, we have reserved column reserved is set to 0 it is set to future use.

we have come to flags,

the first flag mentioned is CWR (congestion window reduced) flag. It is used in conjunction with the ECE flag used by the sending host to indicate a packet 

2nd flag is the ECE (echo congestion notification echo) flag used to echo back the congestion indication (signal the sender to reduce the transmission rate), used in QOS(quality of service)

The urgent (URG) flag indicates the segment is urgent (what it basically says is this part is urgent send as soon as possible

Acknowledgment (ACK) flag used for acknowledgment of data. Acknowledgments and negative acknowledgments inform a sender of the receiver's state so that it can adjust its own state accordingly

Push (PSHflag is set by TCP sender; it forces TCP receiver to pause that segments data to receiver application socket. Used to tell the client/server to go ahead and send what data it has to the receiving application even if its buffer hasn't filled up.

The reset(RSTflag will reset the connection; in other words, the connection is torn down. A TCP segment is sent with an RST flag whenever a segment arrives that does not meet the criteria for a referenced connection.

SYN flag (Synchronisation) flag is a flag used to initiate a connection between two hosts. SYN is used to synchronize numbers; only the first packet from the sender and a receiver should have this flag set.

lastly,

The finish (FIN) flag indicates no more data left from the sender to send.

The window size is 16 bits. The TCP header value allocated for the window size is two bytes long. This means that the highest possible numeric value for a receive window is 65,535 bytes.

Flow control is introduced in this; the number of bytes the receiver is currently willing to receive is known as flow control.

In the 5th layer,

we have a 16-bit checksum and a 16-bit urgent pointer. 

The 16-bit TCP checksum is used for error checking of data to ensure there is o corruption in data error checking is done using checksum. It is computed by the sender and verified by the receiver. It can be a significant advantage.

16-bit urgent point it's used with the urgent flag. It indicates an offset from the sequence number indicating the last urgent data byte. To delete everything in the queue up to the urgent pointer, it is used.

The TCP options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop) are located at the end of the TCP header.



I won't be discussing options briefly here.


the last layer,

unless, like UDP, higher layer protocols are encapsulated within the TCP header.


Applications of UDP:
  • NTP (Network Time Protocol)
  • DNS (Domain Name Service)
  • BOOTP, DHCP.
  • NNP (Network News Protocol)
  • Quote of the day protocol.
  • TFTP, RTSP, RIP.


TCP applications
  • TCP is used extensively by many internet applications, including the world wide web (WWW), email.FTP(file transfer protocol), Secure Shell, peer-to-peer file sharing, and streaming media.

TCP/IP applications, protocols, and services
  • Bootstrap Protocol. ...
  • Connecting to the Internet. ...
  • Dynamic Host Configuration Protocol. ...
  • IBM Tivoli Directory Server for I (LDAP) ...
  • Domain Name System. ...
  • Email. ...
  • File Transfer Protocol. ...
  • IP filtering and network address translation


Thank you for reading my blog,
comment below how do you feel about the blog,
follow for more 



credits:-
vardan

Post a Comment

5 Comments