Previous NET Core Performance Best Practices kubernates Next

TCP/IP communication

What is TCP/IP Communication?

TCP/IP communication refers to the suite of communication protocols used to interconnect network devices on the internet and private networks. TCP/IP stands for Transmission Control Protocol/Internet Protocol, which are the two main protocols in this suite. TCP/IP is responsible for breaking down data into packets, transmitting them over the network, and reassembling them at the destination.

Key Components of TCP/IP Communication

  • Transmission Control Protocol (TCP): TCP is a connection-oriented protocol that ensures reliable data transmission. It establishes a connection between the sender and receiver before data transfer begins, and it guarantees that packets are delivered in the correct order and without errors. If packets are lost or corrupted during transmission, TCP will retransmit them.
  • Internet Protocol (IP): IP is responsible for addressing and routing packets of data so that they can travel across networks and reach the correct destination. Each device on a network is assigned a unique IP address, which is used to identify the source and destination of the data packets.
  • Other Protocols: The TCP/IP suite also includes other protocols such as User Datagram Protocol (UDP), which is a connectionless protocol used for applications that require fast transmission without the need for reliability, and protocols like HTTP, FTP, SMTP, and DNS that operate on top of TCP/IP for specific functions.

TCP/IP — Simple Analogy

🧠 Imagine Sending a Letter

Think of TCP/IP as the postal system of the internet. You want to send a message (say, a photo or a WhatsApp text) from your phone to a friend’s computer. Here's how it works in simple terms:

📦 Step-by-Step Breakdown

  1. You write the letter

    Your app (like Gmail or WhatsApp) creates the message. This is the Application Layer—it knows what you want to say.

  2. You pack it into an envelope

    The Transport Layer (TCP) breaks your message into smaller chunks (called packets), numbers them, and ensures they arrive safely and in order.

  3. You write the address on the envelope

    The Internet Layer (IP) adds the destination address—like your friend’s IP address—so the network knows where to send it.

  4. You hand it to the postman

    The Network Access Layer physically sends the data over cables, Wi-Fi, or mobile networks—like the postman delivering the envelope.

  5. Your friend receives the letter

    Their device reassembles the packets, checks for errors, and shows the full message—just like opening the envelope and reading the letter.

🧭 Why TCP/IP Is Brilliant

  • TCP ensures reliability: If a packet gets lost, it asks for a resend.
  • IP ensures routing: It finds the best path across the internet to reach the destination.
  • Together, they make sure your message gets there accurately and efficiently, even if it travels through dozens of routers and networks.

🧠 Real-Life Analogy

Imagine sending a book by courier, but you tear out each page and send them in separate envelopes. TCP makes sure:

  • Each page is numbered.
  • All pages arrive.
  • If page 5 is missing, it asks you to resend it.
  • Once all pages are there, it reassembles the book.

That’s TCP/IP in action.

Here’s a visual diagram of TCP/IP communication

TCP-IP Communication

Here’s a visual diagram of TCP/IP communication—your internet’s postal system in action: This shows how data flows between two devices (Host 1 and Host 2) through the four layers of the TCP/IP stack:

📦 Layer Breakdown

  • Application Layer: Where your apps live—like browsers, email, or FTP.
  • Transport Layer: Handles reliable delivery (TCP) or fast, connectionless delivery (UDP). Adds TCP/UDP headers for reliability and port targeting
  • Internet Layer: Routes packets across networks using IP addresses. Adds IP headers for routing across networks.
  • Network Access Layer: Deals with physical transmission—Ethernet, Wi-Fi, etc. Adds MAC and physical framing for transmission.

Each layer adds its own header and passes the data down. On the receiving end, each layer strips its header and passes the data up. Like peeling an onion, but with purpose.

Notes

  • Transport (TCP) numbers and reorders packets; requests retransmission if lost.
  • Internet (IP) handles routing between networks using IP addresses.
  • Network Access handles actual delivery over the medium ( MAC , frames, cables, radio).

🧠 Where Does TCP/IP Actually Run?

🖥️ On Your System (End Device)

The full TCP/IP stack is implemented inside your operating system (Windows, Linux, etc.).

It handles:

  • Application Layer: Apps like browsers, email clients.
  • Transport Layer: TCP/UDP for reliable or fast delivery.
  • Internet Layer: IP for addressing and routing.
  • Network Access Layer: Ethernet/Wi-Fi drivers.

Think of this as your personal post office—sending and receiving packets with full control over how they’re packed, tracked, and delivered.

📡 On Routers

Routers do not run full TCP/IP stacks like end systems.

They mostly operate at the Internet Layer:

  • Routing packets based on IP addresses.
  • Performing NAT (Network Address Translation).
  • Enforcing firewalls and access control.

They don’t handle TCP or UDP sessions—those are managed by the devices at either end of the communication.

Routers are like traffic controllers—they don’t care what’s inside the packet, just where it needs to go.

🧩 Summary

Component TCP/IP Role Executes Full Stack?
Your PC/Phone Sends/receives data, manages sessions ✅ Yes
Server Hosts services, manages connections ✅ Yes
Router Routes packets, manages IP addresses ❌ Partial (IP only)

If you’re architecting a driver or service, the TCP/IP stack you interact with is inside your OS kernel or networking libraries. Routers just forward your packets—they don’t parse or respond to them unless they’re acting as a proxy or firewall.

TCP/IP History and Governance

🧠 Who Wrote the TCP/IP Code?

The foundational work was done by:

  • Vinton Cerf and Robert Kahn — often called the fathers of the Internet.
  • They published the first formal specification in RFC 675 (1974), titled “Specification of Internet Transmission Control Program”.
  • Later contributors included Yogen Dalal and Carl Sunshine, who helped revise and refine the early drafts.
  • These pioneers were working under DARPA (Defense Advanced Research Projects Agency) as part of the ARPANET project.

🧬 Versions of TCP/IP

TCP/IP isn’t versioned like a software library—it evolves through RFCs (Request for Comments). But here’s a simplified timeline:

Year Milestone Notes
1974 RFC 675 First spec of TCP/IP (combined protocol)
1981 RFC 791 & RFC 793 Split into IP and TCP; this is IPv4 and classic TCP
1994 IPng (IP Next Generation) Led to IPv6, standardized in RFC 2460
2000s–Present TCP Variants TCP Tahoe, Reno, NewReno, CUBIC, BBR etc. (used in Linux, Windows, macOS)

TCP has over 100+ variants proposed in literature, with CUBIC being the default in Linux and Windows today.

🏛️ Who Controls TCP/IP Versioning?

The protocol suite is governed by:

  • IETF (Internet Engineering Task Force) — the global standards body.
  • They publish and maintain RFCs, which define every aspect of TCP/IP.
  • Oversight comes from the Internet Architecture Board (IAB), which ensures consistency and long-term vision.
  • Anyone can propose changes via an RFC, but adoption requires rigorous peer review and consensus within the IETF.

🧩 Summary

  • TCP/IP was invented by Cerf & Kahn, refined by Dalal & Sunshine.
  • It evolved through RFCs, not traditional versioning.
  • IETF governs its evolution, ensuring global interoperability.
  • If you’re building protocol-aware systems or custom drivers, understanding how TCP variants behave under congestion, latency, and retransmission is key.

Here's a breakdown of the most widely used TCP congestion control algorithms

🚦 TCP Variants: Reno vs CUBIC vs BBR

Feature TCP Reno TCP CUBIC TCP BBR (Bottleneck Bandwidth & RTT)
📅 Introduced 1995 2006 (Linux default) 2016 (Google)
📈 Growth Strategy Linear increase, halving on loss Cubic curve (fast ramp-up) Bandwidth estimation + RTT probing
🧠 Intelligence Loss-based Loss-based with time scaling Model-based (not loss-driven)
🌐 Ideal Use Case Low-latency, low-bandwidth High-speed, long-distance links Streaming, real-time, cloud apps
🔁 Reaction to Loss Halves congestion window Reduces based on cubic curve Doesn’t react to loss immediately
🚀 Throughput Potential Moderate High Very High
🧪 Fairness Good with similar flows Better in mixed environments Can be aggressive vs legacy TCP

🧠 Strategic Engineering Insights

✅ When to Use What

  • TCP Reno: Still used in legacy systems or embedded stacks. Simple and predictable.
  • TCP CUBIC: Default in Linux and Windows. Great for general-purpose workloads.
  • TCP BBR: Ideal for video streaming, real-time APIs, and cloud-native services where latency and throughput matter more than fairness.

🔧 How to Tune in .NET Core

Use SocketsHttpHandler with HttpClient to leverage OS-level TCP stack.

For Linux-hosted apps, check and tune:

sysctl net.ipv4.tcp_congestion_control

You can switch between reno, cubic, or bbr if supported.

🧩 Performance Engineering Tip

If you're profiling a high-throughput .NET Core service:

  • Measure RTT, packet loss, and bandwidth.
  • Choose TCP variant based on workload type:
    • BBR for streaming or telemetry.
    • CUBIC for general APIs.
    • Reno only if compatibility demands it.

🧠 1. MAC Address (Media Access Control)

This is a unique hardware identifier assigned to your network device (like a Wi-Fi card or Ethernet adapter). It operates at the Data Link Layer of the OSI model.

🔍 Key Facts:

  • It’s a 48-bit hexadecimal number, like D4-BE-D9-8D-46-9A.
  • Assigned by the device manufacturer and burned into the hardware.
  • Used for local network communication (e.g., LAN).
  • Helps routers and switches identify devices on the network.
Back to Index
Previous NET Core Performance Best Practices kubernates Next
*