Computer Network Tutorial

Introduction of Computer Network Types of Computer Network Network Topology Computer Networking Architecture Transmission Modes (Data Flow) Basic Networking Devices Integrate Services Digital Network (ISDN)

Model

OSI Model TCP/IP Model

Physical Layer

Digital Transmission Analog Transmission Transmission Media Switching

Data Link Layer

Error detection and Error correction Data Link Control Multiple Access Aloha

Network Layer

Network Layer - Logical Address Address Mapping Unicast Routing Protocol

Transport Layer

Process to Process Delivery User Datagram Protocol Transmission Control Protocol Stream Control Transmission Protocol Session Layer and Presentation Layer

Application Layer

Domain Name System Application Protocol E-mail Cryptography

Misc

Classes of Routing Protocols Classification of Routing Algorithms Controlled Access Protocols in Computer Networks Differences between IPv4 and IPv6 Fixed and Flooding Routing Algorithms Advantages and Disadvantages of Fibre Optics Cable APIPA Difference between Active and Passive FTP Fiber Optics and its Types Method of Joining and Fusion of Fiber Optic Cable Define Framing in Computer Network Disadvantages of Computer Network Mesh Topology Diagram in Computer Network Ring Topology in Computer Network Star Topology in Computer Networks 4G Mobile Communication Technology Advantages and Disadvantages of LAN Advantages and Disadvantages of MAN Advantages and Disadvantages of WAN Application Layer in OSI Model Cyclic Redundancy Check Example Data link layer in OSI model Difference between Transport and Network Layer Hamming Code Example Network Layer in OSI Model Session Layer in OSI Model Transport Layer in OSI Model Two Port Network in Computer Networks Uses of Computer Networks What is Computer Network What is Framing in a Computer Network Advantages and Disadvantages of Bus Topology Difference between Star Topology and Bus Topology Subnetting in Computer Network Subnetting Questions and Answers What is Bus Topology What is Network Topology and Types in Computer Networks Access Control in Networking Basic Characteristics of Computer Network Benefits of SOCKS5 Proxy in Computer Networks Computer Network viva Questions Difference between BOOTP and RARP Difference Between Network Topologies and Network Protocols Difference between NFC and RFID Difference Between Point-to-Point Link and star Topology Network Differences Between MSS and MTU Differences Between Trunk Port and Access Port Different Modes of Communication in Computer Networks MIME Protocol in Computer Networks Modes of Communication in Computer Networks Network Attack in Computer Network Port Address in Networking Simplest Protocol in Computer Network Sliding Window Protocol in Computer Network Stop And Wait Protocol in Computer Networks TCP 3-Way Handshake Process in Computer Networks What is a Proxy Server What is APPN What is ICMP Protocol What is Point-to-Point Protocol What is Port Address in Networking What is the HDLC Protocol What is VRRP Protocol Difference Between Analog and Digital Signals Difference Between Hub and Repeater Difference between Repeater and Switch Difference Between Transparent Bridge and Source Routing Bridge Source Routing Bridge in Computer Networks Transparent Bridge in Computer Networks Transport Protocol in Computer Networks Types of CSMA in Computer Networks What is Wired and Wireless Networking Network Security in Computer Network Disadvantages of Extranet Difference Between TELNET and FTP Define Protocol in Computer Networks Guided Transmission Media in Computer Network What is a Gateway in a Computer Network IGMP in Computer Networks LAN Protocols in Computer Networks MAN Meaning in Computer Modulation Techniques in Computer Networks Switching in DCN TCP/IP Applications What is IGMP? What is Modem in Networking What is Non-Persistent CSMA Difference between Cell Splitting and Cell Sectoring Forouzen Computer Network

TCP vs UDP

Transmission Control Protocol (TCP) and User Datagram Protocol are the two most popular Internet protocols (IPs). TCP is a connection-oriented protocol, which means that once a connection has been made, data can be sent in both directions. While,UDP is a connectionless protocol. Multiple messages are sent using UDP as the chunks of packets.

What is TCP?

TCP is a transport layer protocol that emphasizes connections. It makes sure that data is transmitted securely between two devices connected to a network.  The data can only be sent when a secure connection has been established.

The receiver sends an acknowledgment of receiving the data after receiving it. To transfer data between devices, it uses data blocks. It has more system functionalities, including flow control, error control, and congestion control, but it transmits data slowly. The TCP header is 20-60 bytes long and contains a variety of information to improve reliability.  TCP is used by protocols like HTTP, FTP, etc. for secure data transmission over networks because of its dependability.

Two features of TCP

Stream Data Transfer

Applications at the Application Layer send a continuous stream of bytes to the lower layers. It is TCP's responsibility to divide this byte stream into packets called TCP segments, which are sent over the IP layer to the destination device. The application doesn't need to worry about the byte stream data packets being corrupted.

Reliable

TCP's most important feature is its ability to deliver data reliably. To ensure dependability, the data that is corrupted, misplaced, duplicated, or delivered by the Network Layer must be restored by TCP. Each byte sent over TCP has a unique sequence number, and the receiving TCP layer is required to respond for each byte. The data is retransmitted if acknowledgment is not received by the sender.

What is UDP?

UDP is a connectionless transport layer protocol. It means User Datagram Protocol. In this context, connectionless denotes the absence of any established connections before communication which means it doesn't ensure that data packets will be delivered or received. It allows for the rapid transmission of data between two connected devices via a network. In UDP, no cost is used to set up, manage, and close the connections.

It is primarily used to transmit real-time data where transmission delays cannot be accepted. Continuous data streams are used by UDP to send data from one device to another.

The UDP header has a fixed size of 8 bytes. It is unreliable, but it is faster. Due to its quick transmission speed, protocols like DNS, DHCP, RIP, and others use UDP to properly transmit data over networks. The "fire-and-forget" protocol is another name of it because it doesn't care that the acknowledgment is received by the sender or not.

Difference between TCP and UDP

TCPUDP
TCP stands for Transmission Control ProtocolUDP means User Datagram Protocol.
TCP is a connection-oriented transport layer protocol. It stands for Transmission Control Protocol. It ensures a secure connection and data transmission between two devices connected via a network.UDP is a connectionless transport layer protocol. In this context, connectionless denotes the absence of any established connections before communication which means it doesn't ensure that data packets will be delivered.
The connection must be established before the transmission of data over the network in this protocol. So, it connection oriented protocolThe connection is not mandatory for the receiver side in this protocol. So, it is a connectionless protocol.
TCP is reliable because it guarantees that the data is delivered to the right destination or not.UDP does not allow for the guarantee of data delivery to the target destination.
It ensures the data receiving at  the right destination by acknowledgment.It doesn’t have any acknowledgment through the receiver's end so it does not ensure that the data is received at the right destination or not.
Multiple error-checking mechanisms are present in TCP because this protocol offers acknowledgment and control over data flow.UDP only has a simple checksum-based error checking mechanism.
TCP transmits data in a specific sequence, which means that packets arrive at the receiver’s end in the correct order.The application layer must control the ordering of data because UDP lacks data sequencing.
In TCP, data packets can be retransmitted if they are lost.The data can not be retransmitted if they are lost in the case of UDP.
When compared to UDP, its performance is slower and less effective.UDP is more efficient and faster than TCP.
The Transmission Control Protocol includes a function of data sequencing. This implies that packets reach their destination in the same order in which they were sent.Data sequencing is absent in UDP. If necessary, the order must be managed by the application layer.
FTP, HTTP, HTTPS, SMTP, Telnet, and SMTP use TCP.UDP is used by VoIP, SNMP, RIP, DHCP, TFTP, DNS, and DHCP.
The three-way handshake concept is used by TCP. In this concept, the sender will send the data if the acknowledgment is received. TCP is also capable of resending lost data.It does not wait for an acknowledgement before sending data.
This protocol is primarily used in situations that require a secure and reliable communication process, such as military services, web browsing, and e-mail.This protocol is used in situations where quick communication is necessary but where reliability is not a concern, such as VoIP, game streaming, video, and music streaming, etc.

Conclusion

Transmission Control Protocol (TCP) and User Datagram Protocol are the two most popular Internet protocols (IPs). TCP is a connection-oriented protocol, which means that once a connection has been made, data can be sent in both directions. While,UDP is a connectionless protocol. Multiple messages are sent using UDP as the chunks of packets.