TCP (Transmission Control Protocol):
The translation control protocol (TCP) is just a connection-oriented, reliable protocol. TCP explicitly defines connection establishment, data transfer, and connection tear-down phases to offer a connection-oriented service. TCP uses a combination of GBN and SR protocols to offer reliability. To achieve this goal, TCP uses checksum, retransmission of lost or corrupt packets, timers, etc. TCP is the most frequent transport-layer protocol on the internet.
Services offered by TCP:
1) Process-to-process Communication – TCP provides process-to-process communication, i.e, the transfer of data that happens between individual processes executing on end systems. This is done by exploiting port numbers or port addresses. Port numbers are 16 bits long which supports identify which process is sending or receiving data on a host.
2) Stream Delivery Service –TCP is really a stream-oriented protocol. It allows the sending process to provide data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes. TCP creates an environment where the two processes appear to be connected by an imaginary “tube” that carries their bytes across the Internet. The sending process produces (write to) the stream and the receiving process consumes (read from) it.
3) Full-Duplex Communication – TCP offers a full-duplex service, where data can flow in both directions at the exact same time. Each TCP endpoint then has its sending and receiving buffer, and segments move around in both directions.
4) Multiplexing and Demultiplexing – TCP performs multiplexing at the sender and demultiplexing at the receiver ends as several logical connections could be established between port numbers over an actual connection. However, TCP is really a connection-oriented protocol, an association must be established for each pair of processes.
5) Connection-Oriented Services – TCP is really a connection-oriented protocol. When a process at site A really wants to send and receive data from another process at site B, the next three phases occur :
- The two TCP’s set up a logical connection between them.
- Data are exchanged in both directions.
- The bond is terminated.
There is no physical connection. TCP creates a stream-oriented atmosphere wherever it accepts the responsibility of delivering the bytes to the other website.
6) Reliable Service – It is really a reliable protocol. It uses an acknowledgment mechanism to test to safe and sound arrival of data. Also, it uses congestion control mechanisms.
The TCP connection is logical, not physical. It operates at an increased level. It uses the services of IP to supply individual segments to the receiver, however, it controls the bond itself. If a segment is lost or corrupted, it’s retransmitted.
In TCP, transmission requires three phases:
- Connection Establishment
- Data Transfer
- Connection Termination
The transmission control protocol requires establishing a link via a three-way handshake before transferring data packets from the server to the client. The three-way handshake process, which starts with the exchange of SYN, SYN-ACK, and ACK messages (known as flags) between these entities, helps to make sure that a reliable connection is created between them. The three messages are the next:
- SYN — synchronize
- SYN-ACK — synchronize-acknowledgment
- ACK — acknowledge
Once that connection is established, each segment of data that is sent from the client to the server is accompanied by an ACK flag to verify receipt of the info packet.
Advantages of TCP:
- It helps one to establish/set up a link between several types of computers.
- It operates independently of the operating system.
- It supports many routing protocols.
- It enables internetworking between the organizations.
- TCP/IP model has a very scalable client-server architecture.
- It could be operated independently.
- Supports several routing protocols.
- It can be used to set up a connection between two computers.
Disadvantages of TCP:
- TCP ne’er concludes a transmission without all information in motion being explicitly asked.
- You can’t use it for broadcast or multicast transmission.
- TCP does not have any block boundaries, so you will need to create your own.
- TCP offers many features that you never want. It could waste bandwidth, time, or effort.
- In this, model the transport layer does not guarantee the delivery of packets.
- Replacing protocol in TCP/IP isn’t easy.
- It does not offer clear separation from its services, interfaces, and protocols.
Protocols using TCP transmission:
- HTTP(Hypertext Transfer Protocol)
- HTTPS(Hypertext Transfer Protocol Secure)
- FTP(File Transfer Protocol)
- SMTP(Simple Mail Transfer Protocol)
UDP (User Datagram Protocol):
The User Datagram Protocol (UDP) is really a connectionless, unreliable transport protocol. It generally does not add anything to the services of IP except for providing process-to-process communication in place of host-to-host communication. If UDP is indeed powerless, why would a procedure wish to use it? With the disadvantages come some advantages. It is really a very simple protocol using at the least overhead. If a procedure really wants to send a tiny message and doesn’t care much about reliability, it can use UDP. Sending a tiny message using UDP takes much less interaction between the sender and receiver than using TCP.
Features of UDP protocol:
1) Transport layer protocol – UDP could be the simplest transport layer communication protocol. It includes a minimum level of communication mechanisms. It is known as an unreliable protocol, and it is founded on best-effort delivery services. UDP provides no acknowledgment mechanism, which means that the receiver doesn’t send the acknowledgment for the received packet, and the sender also doesn’t await the acknowledgment for the packet that it has sent.
2) Connectionless – The UDP is a connectionless protocol as it does not create an electronic path to transfer the data. It does not utilize the virtual path, so packets are submitted to different paths involving the sender and the receiver, which leads to the loss of packets or received out of order.
3) Ports – The UDP protocol uses different port numbers so that the data may be delivered to the correct destination. The port numbers are defined between 0 and 1023.
4) Faster transmission – UDP enables faster transmission as it is a connectionless protocol, i.e., no virtual path is required to transfer the data. But there is the opportunity that the patient packet is lost, which affects the transmission quality. On one other hand, if the packet is lost in the TCP connection, that packet is going to be resent, so it guarantees the delivery of the information packets.
5) Acknowledgment mechanism – The UDP comes with any acknowledgment mechanism, i.e., there is no handshaking involving the UDP sender and UDP receiver. If the message is submitted TCP, then the receiver acknowledges that I am ready, then the sender sends the data. In the case of TCP, the handshaking occurs involving the sender and the receiver, whereas, in UDP, there is no handshaking involving the sender and the receiver.
6) Segments are handled independently. – Each UDP segment is handled individually by others as each segment has a different path to reach the destination. The UDP segments may be lost or delivered out of order to achieve the destination as there is no connection setup involving the sender and the receiver.
7) Stateless – It is a stateless protocol which means that the sender doesn’t have the acknowledgment for the packet which includes been sent.
- Useful for simple request-response communication when the size of data is less and hence there’s lesser concern about flow and error control.
- It is really a suitable protocol for multicasting as UDP supports packet switching.
- UDP is employed for some routing update protocols like RIP (Routing Information Protocol).
- Normally employed for real-time applications which could not tolerate uneven delays between chapters of a received message.
- UDP has a datagram from Network Layer, attaches its header, and sends it to the user. So, it works fast.
Advantages of UDP:
- It never restricts one to a connection-based communication model; that’s why startup latency in distributed applications is low.
- The recipient of UDP packets gets them unmanaged, which also incorporates block boundaries.
- Broadcast and multicast transmission are also available in UDP
- Data loss could be made
- Small transaction (DNS lookup)
- Bandwidth intensive app which endures packet loss
Disadvantages of UDP:
- In UDP protocol, a package may not be delivered. It might be delivered out of order, so you receive no indication.
- Routers can be careless with UDP, so they never retransmit it when it collides.
- UDP does not have any congestion control and flow control, so implementation is the task of an individual application.
- UDP mostly suffers from worse packet loss.
Protocols using UDP transmission:
- DHCP(Dynamic Host Configuration Protocol)
- DNS(Domain Name Server) or DNS Server
- TFTP(Trivial File Transfer Protocol)
- NTP (Network Time Protocol)
- NNP (Network New Protocol)
- RIP(Routing Information Protocol)
TCP vs UDP:
|It is a connection-oriented protocol.||It is a connectionless protocol.|
|TCP reads data as streams of bytes, and the message is transmitted to segment boundaries.||UDP messages contain packets that were sent one by one. It also checks for integrity at the arrival time.|
|TCP messages make their way across the internet from one computer to another.||It is not connection-based, so one program can send lots of packets to another.|
|TCP rearranges data packets in a specific order.||UDP protocol has no fixed order because all packets are independent of each other.|
|The speed for TCP is slower.||UDP is faster as error recovery is not attempted.|
|Header size is 20 bytes||The header size is 8 bytes.|
|TCP is heavy-weight. TCP needs three packets to set up a socket connection before any user data can be sent.||UDP is lightweight. There are no tracking connections, ordering of messages, etc.|
|TCP does error checking and also makes error recovery.||UDP performs error checking, but it discards erroneous packets.|
|Acknowledgment segments||No Acknowledgment segments|
|Using handshake protocols like SYN, SYN-ACK, ACK||No handshake (so connectionless protocol)|
|TCP is reliable as it guarantees the delivery of data to the destination router.||The delivery of data to the destination can’t be guaranteed in UDP.|
|TCP offers extensive error checking mechanisms because it provides flow control and acknowledgment of data.||UDP has just a single error checking mechanism that is used for checksums.|