TCP / IP Basics : The Foundation of Internet Communication

TCP / IP Basics : The Foundation of Internet Communication

Table of Content :

  1. What is Protocol

  2. Introduction to TCP / IP and UDP

  3. Difference Btw TCP and UDP

What is Protocol ?

Protocal is set of rules and guidelines that govern the communication and interaction between entities in a system . In the context of computer networks , a protocal defines how data is transmitted , received , and interpreted btw devices or systems to enable effective communication.

Network protocols are specifically designed to facilatate the exchange of data and information between devices connected to network.

Protocals can operate at different layers of the network stack, with layer responsible for a specific aspect of communication . For example , the IP (Internet Protocal ) operates at the network layer and defines the addressing scheme and routing mechanisms, while the Transmission Control Protocol operates at the transport layer and provides reliable, connection-oriented data delivery .

Layers of the Network Stack

TCP - Transmission Control Protocal

It is one of the core protocals of the Internet protocol suite (TCP/IP) and operates at the transport layer of the network stack . TCP provides reliable , connection-orientend , communication between devices over IP- Based networks.

Prominent Feature of TCP

  1. Connection-Oriented : TCP establishes a dedicated connection between two specific servers for data transmission , unlike UDP which can send data from one server to multiple servers simultaneously .

  2. Reliable Delivery : TCP ensures delivery of segments, regardless of network conditions. It employs mechanisms like acknowledgment retransmission and error detection to guarantee data integrity.

  3. Bitstream- Oriented : TCP treats data as a continous stream of bits. It segments the application layer data without being aware of message boundaries. The segment must be processed sequentially , and any duplicated segments are discarded .

Understanding how TCP works via an example

Suppose you want to download a file from a web server using TCP . Here’s step by step explanation of how the TCP communication would occur :

  1. Connection Establishment :

    • Your web browser (the client ) intiates a connection request to the web sever.

    • The web server responds by acknowledging the request and agreeing to establish a connection .

    • This three-way handsake ensures synchronization and sets up intial parameters for communication .

  1. Data Segmentation

    • The file you want to download is divided into smaller segments or packets like 10 packets labeled from 1 to 10 .
  2. Reliable Delivery

    • The client starts sending the packets to the server .

    • For each packet sent , the client waits for an acknowledment (ACK ) from the server.

    • Upon receiving each packet, the server sends an ACK to the client to confirm successful receipt .

    • If the client doesn’t receive an ACK within a certain timeframe, ti re-transmits the packet.

  3. Flow Control :

    • The server manages its buffer space and signals the client about the available space.

    • If the client receives a limited ACK window size , it adjusts the rate of packet transmission to match the available buffer space on the server

  4. Connection Termination :

    • Once all the packets are successfully received , the client and server initiate a connection termination process .

    • They exchange messages to ensure the completion of data transfer and agree to close the connection .

    • The four-way handshakes concludes the communication .

Throughout the process, TCP uses checksums to detect any errors in packet transmission. If errors are detected, TCP requests the retransmission of those packets.

UDP - User Datagram Protocol

It is connectionless ,lightweight transport layer protocol within the IP suite. UDP is a simple, best-effort protocol that offers low overhead and minimal error checking , making it suitable for scenarios where speed and effieciency are prioritized over reliablity.

Prominent Features of UDP

  1. Connectionless Communication : UDP is a connectionless protocal , meaning that it does not establish a dedicated connection before transmitting data. it allows sending individual packets from the source to the destination withour any prior synchronization .

  2. Fast and Lightweight : UDP is desinged for speed and effieciency . It operates with less protocal -related processing, making it faster and more suitable for appliactions that require real-time data transmission such as audio/video streaming or real-time gaming.

  3. Unreliable Delivery: UDP does not guarantee the delivery of packets or the order in which they are received. It does not provide acknowledgment or retransmission mechanisms for lost or corrupted packets. Therefore, reliability and error-checking must be handled at the application layer if needed.

Understanding how UDP works via an example

Suppose you want to send a message from one device (sender) to another device (receiver) using UDP. Here’s a step-by-step explanation of how the UDP communication would occur:

1. Sender Preparation:
— The sender prepares the message to be sent.
— The sender specifies the IP address and port number of the receiver to ensure the message reaches the intended destination.

2. Message Packaging:
— The sender encapsulates the message within a UDP packet, also known as a datagram.
— The sender includes the source port number and the destination port number of the receiver in the UDP header.
— The sender calculates a checksum value based on the contents of the UDP packet, which can be used by the receiver to check for transmission errors.

3. Packet Transmission:
— The sender transmits the UDP packet containing the message over the network.
— UDP does not establish a connection before sending the packet, so it can be sent directly to the receiver without any prior synchronization.

4. Receiver Reception:
— The receiver listens for incoming UDP packets on its designated port.
— When the UDP packet arrives, the receiver extracts the message from the packet.
— The receiver uses the source port number to identify the sender of the message.

5. Message Processing:
— The receiver processes the message based on its application requirements.
— UDP does not guarantee the order of packet delivery or reliability, so the receiver handles any necessary error detection or reordering at the application layer.

Signing Off!!

Finishing off with the article here. I really hope, I made the article worth your while and you learned a great deal from it.

More than happy to address any improvements and suggestions. Please feel free to drop a comment.

Connect with me via: LinkedIn