TCP and UDP comparison and itsi application.pptx

Mugabo4 42 views 9 slides Oct 13, 2024
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

TCP and UDP comparison


Slide Content

Transmission Control Protocol  ( TCP ) and User Datagram Protocol  ( UDP )

Transmission Control Protocol  ( TCP ) The  Transmission Control Protocol  ( TCP ) is one of the main  protocols  of the  Internet protocol suite . It originated in the initial network implementation in which it complemented the Internet Protocol  (IP). Therefore, the entire suite is commonly referred to as  TCP/IP . TCP provides  reliable , ordered, and  error-checked  delivery of a  stream  of  octets  (bytes) between applications running on hosts communicating via an IP network TCP is  connection-oriented , and a connection between client and server is established before data can be sent

TCP segment structure A TCP segment consists of a segment  header  and a  data  section. The segment header contains 10 mandatory fields, and an optional extension field. The data section follows the header and is the payload data carried for the application .

TCP Header 1. Source Port(16 bits):  This field identifies the port number of the Sender’s application program. 2.   Destination Port(16 bits):  This field identifies the port number of the Receiver’s application program . 3. Sequence Number(32 bits):  After connection establishment(3-way handshaking), this field contains a 32-bit random initial sequence number/starting data bit which is subsequently incremented by the number of bytes transferred. 4.   Acknowledgment Number(32 bits):  The receiver uses this 32-bit parameter to request the next TCP segment. It’s the next predicted TCP segment’s sequence number. 5. Header length field(4 bits):  This field indicates the size of the TCP header but in a scaled-down version. 6. Reserved bits(6 bits):  The bits of this field are set to zero. These bits are reserved for later use. 7. Flag bits(6 bits):  A grouping of six fields, each of which is one bit long. It can be used to control the flow of data in specific scenarios. URG flag (urgent flag):  When this 1-bit value is set, the data is given precedence over other data. ACK flag (acknowledgment flag):  This 1-bit field is used during connection establishment (3-way handshaking) and data transfer. PSH flag (push flag):  This 1-bit field tells an application that the data should be sent immediately. RST flag (reset flag):  To reset the TCP connection this 1-bit field is set. SYN flag (synchronization flag):  This 1-bit flag is used to set the initial sequence number. FIN flag (the finish flag):  This 1-bit field indicates the end of the TCP connection. 8. Window Size(16 bits):  This parameter represents the buffer capacity at the receiver’s end. The size of the window is used to manage the flow of data. 9. Checksum(16 bits):  The sender calculates a Cyclic Redundancy Check (CRC) checksum and adds it to this field before transmission of data to prevent errors in data. The checksum can be used by the receiving device to check for flaws in the received header and payload. 10. Urgent Pointer(16 bits):  The urgent pointer points to the end of urgent data in the segment. However, this field appears only if the URG flag is set. 11.   Options/optional data(0-40 Bytes):  This field contains optional pieces of information such as Maximum Segment Size, Timestamp, Window size extension, Padding, etc.

UDP structure

User Datagram Protocol  ( UDP ) the  User Datagram Protocol  ( UDP ) is one of the core  communication protocols  of the  Internet protocol suite  used to send messages (transported as  datagrams  in  packets ) to other hosts on an  Internet Protocol  (IP) network. Within an IP network, UDP does not require prior communication to set up  communication channels  or data paths . UDP is suitable for purposes where error checking and correction are either not necessary or are performed in the application; UDP avoids the overhead of such processing in the  protocol stack . 

UDP datagram structure Source port number: This field identifies the sender's port, when used, and should be assumed to be the port to reply to if needed. If not used, it should be zero. If the source host is the client, the port number is likely to be an ephemeral port. If the source host is the server, the port number is likely to be a  well-known port  number from 0 to 1023. Destination port number: This field identifies the receiver's port and is required. Similar to source port number, if the client is the destination host then the port number will likely be an ephemeral port number and if the destination host is the server then the port number will likely be a well-known port number. Length: This field specifies the length in bytes of the UDP header and UDP data. The minimum length is 8 bytes, the length of the header. The field size sets a theoretical limit of 65,535 bytes (8-byte header + 65,527 bytes of data) for a UDP datagram. However, the actual limit for the data length, which is imposed by the underlying  IPv4  protocol, is 65,507 bytes (65,535 bytes − 8-byte UDP header − 20-byte  IP header ). Checksum The  checksum  field may be used for error-checking of the header and data. This field is optional in IPv4, and mandatory in most cases in IPv6. [7]  The field carries all-zeros if unused .

Basis         Transmission Control Protocol (TCP)        User Datagram Protocol (UDP) Type of Service TCP  is a connection-oriented protocol. Connection  orientation means that the communicating devices should establish a connection before transmitting data and should close the connection after transmitting the data. UDP  is the Datagram-oriented protocol. This is because  there is no overhead for opening a connection, maintaining a connection, or terminating a connection. UDP is efficient for broadcast and multicast types of network transmission. Reliability TCP is reliable as it guarantees the delivery of data to the destination router. The delivery of data to the destination cannot be guaranteed in UDP. Error checking mechanism                                  TCP provides extensive error-checking mechanisms.  It is because it provides flow control and acknowledgment of data. UDP has only the basic error-checking mechanism using checksums. Acknowledgment An acknowledgment segment is present. No acknowledgment segment. Sequence Sequencing of data is a feature of Transmission Control  Protocol (TCP). this means that packets arrive in order at the receiver. There is no sequencing of data in UDP. If the order is required, it has to be managed by the application layer. Speed TCP is comparatively slower than UDP. UDP is faster, simpler, and more efficient than TCP. Retransmission Retransmission of lost packets is possible in TCP, but not in UDP. There is no retransmission of lost packets in the User Datagram Protocol (UDP). Header Length TCP has a (20-60) bytes variable length header. UDP has an 8 bytes fixed-length header. Weight TCP is heavy-weight. UDP is lightweight. Handshaking Techniques Uses handshakes such as SYN, ACK, SYN-ACK It’s a connectionless protocol i.e. No handshake Broadcasting TCP doesn’t support Broadcasting. UDP supports Broadcasting. Protocols TCP is used by  HTTP, HTTPs ,  FTP ,  SMTP  and  Telnet . UDP is used by  DNS ,  DHCP , TFTP,  SNMP ,  RIP , and  VoIP . Stream Type The TCP connection is a byte stream. UDP connection is a message stream. Overhead Low but higher than UDP. Very low. Applications This protocol is primarily utilized in situations when a safe and trustworthy communication procedure is necessary, such as in email, on the web surfing, and in military services. This protocol is used in situations where quick communication is necessary but where dependability is not a concern, such as VoIP, game streaming, video, and music streaming, etc. Differences between TCP and UDP The main differences between TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are:

TCP&UDP Comparison
Tags