Fundamentals 7 min read

Fundamentals of Network Programming: Layers, TCP Model, and I/O Models

This article introduces fundamental network programming concepts, including OSI and TCP/IP layering, TCP connection establishment and termination, essential socket functions for client and server, key terms like backlog and RTT, the stream nature of TCP, and various I/O models such as blocking, non‑blocking, multiplexing, signal‑driven, and asynchronous I/O.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Fundamentals of Network Programming: Layers, TCP Model, and I/O Models

The 360 OpsDev team launched a technical sharing series; this second session focuses on the basics of network programming, covering network layering, the TCP programming model, and I/O models.

Network Layering – The article presents the OSI seven‑layer model and the TCP/IP four‑layer model, explaining that the kernel handles the lower layers while applications operate at the upper layers.

TCP Connection Creation and Termination – It describes the three‑way handshake for establishing a TCP connection and the four‑step teardown, illustrated with diagrams showing the corresponding programming functions and TCP state transitions.

Server‑Side Socket Functions – The essential functions are socket, bind, listen, accept, read, write, and close.

Client‑Side Socket Functions – The required functions are socket, connect, write, read, and close.

Key Concepts – The backlog argument defines the maximum length of the pending‑connection queue, and RTT (Round‑Trip Time) measures the time for a packet to travel to the destination and back.

TCP Stream – TCP is described as a stream where the kernel provides separate send and receive buffers for each connection; the application reads from and writes to these buffers, while the kernel handles actual network transmission.

TCP State Diagram – A diagram shows the various TCP states and their transitions, noting that the details can be consulted as needed.

I/O Models – Unix defines several I/O models: blocking I/O, non‑blocking I/O, I/O multiplexing (e.g., epoll, libevent), signal‑driven I/O, and asynchronous I/O. Each model’s characteristics and typical use cases are explained, with illustrative images for each.

Conclusion – Understanding these foundational concepts enables developers to design and troubleshoot network programs effectively. References include classic books such as "UNIX Network Programming (Volume 1)", "TCP/IP Illustrated (Volume 1)", and the "Linux/UNIX System Programming Manual".

TCPLinuxNetwork ProgrammingsocketIO models
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.