Master Computer Network Basics: TCP, UDP, HTTP, and Socket Essentials
This comprehensive guide walks you through the core concepts of computer networking, including the OSI and TCP/IP models, detailed explanations of TCP and UDP protocols, HTTP fundamentals, socket programming, IP addressing, ICMP, ping operations, and the differences between routers, switches, cookies, sessions, and tokens.
Introduction Computer network fundamentals are essential knowledge for R&D and operations engineers, but they are often overlooked. This guide provides a detailed and clear overview of TCP/UDP protocols, HTTP, Socket, and related concepts.
1. Computer Network Architecture
1.1 Overview
Definition: The collection of layers and protocols that constitute a computer network.
Purpose: Defines the capabilities a network can provide.
1.2 Structural Introduction
Computer network architectures are divided into three models: OSI, TCP/IP, and the Five‑layer model.
OSI model: Conceptually clear and complete, but complex and not practical for everyday use.
TCP/IP model: Consists of a series of protocols that form the foundation of the Internet; it is the core protocol suite for both LANs and WANs.
Five‑layer model: Integrates OSI and TCP/IP models to simplify learning and explaining computer networking principles.
Lower three layers form the communication sub‑network responsible for data transmission; upper three layers form the resource sub‑network, analogous to a computer system that processes data. The transport layer connects the two.
2. TCP Protocol
Transmission Control Protocol (TCP) is a transport‑layer communication protocol.
It belongs to the transport layer.
Application‑layer protocols based on TCP include HTTP, SMTP, FTP, Telnet, and POP3.
Additional TCP concepts such as the three‑way handshake, four‑way termination, and error‑control mechanisms are covered in dedicated articles.
3. UDP Protocol
3.1 Definition
User Datagram Protocol (UDP) is a transport‑layer communication protocol.
It belongs to the transport layer.
Application‑layer protocols based on UDP include TFTP, SNMP, and DNS.
3.2 Characteristics
Connectionless, unreliable, message‑oriented, and without congestion control.
3.3 Advantages and Disadvantages
Advantage: High speed.
Disadvantage: Messages can be lost, especially on poor networks.
3.4 Application Scenarios
Used when high communication speed is required.
Examples: Domain name resolution – DNS File transfer – FTP Network management – SNMP Remote file server – NFS
3.5 UDP Packet Format
UDP packets consist of two fields: data and header. The header is 8 bytes long and contains four sub‑fields.
3.6 Differences Between TCP and UDP
(Illustrated by the accompanying diagram.)
4. HTTP Protocol
Introduction to the Hypertext Transfer Protocol.
5. Socket
5.1 Overview
A socket is an abstraction layer that provides a programming interface (API) for applications to communicate over the TCP/IP protocol suite.
A socket is not a protocol; it is an API that operates at the transport layer, handling how data is transmitted over the network.
Through sockets, developers can create networked applications on platforms such as Android using TCP/IP.
From the user's perspective, invoking the socket API allows data to be organized according to the required protocol for communication.
Socket representation: Socket = {(IP address 1:PORT), (IP address 2:PORT)} Each socket instance uniquely represents a communication link for an application on a host.
6. Additional Knowledge
6.1 Process of Entering a URL in a Browser
Which protocols are used when opening a web page?
6.2 IP Address (IPv4)
Definition: A globally unique identifier for each host (or router) connected to the Internet.
Composition: An IP address is 32 bits, consisting of a network portion and a host portion (IP address = {network number, host number}).
Network number: Identifies the network to which a host or router is connected; it must be unique across the Internet. Host number: Identifies the specific host within that network; it must be unique within the network.
Different IP address types allocate varying numbers of bits to the network and host portions, ensuring global uniqueness.
Classification: Traditional classful addressing divides IP addresses into classes A, B, C, D, and E.
The distinction lies in the number of bytes allocated to the network and host numbers.
6.3 ICMP Protocol
Definition: Internet Control Message Protocol, used for sending control messages.
It belongs to the IP layer.
ICMP messages are not high‑level protocols; they are encapsulated within IP datagrams.
Purpose: Improves the forwarding of IP packets and increases successful delivery chances.
It also allows hosts and routers to report errors and abnormal conditions.
Categories: ICMP error messages and ICMP query messages.
Major applications: PING (packet network probing) and Traceroute (tracing the path of packets from source to destination).
6.4 Ping Process
Definition: Packet Internet Groper, a tool for network probing.
Uses ICMP echo request and echo reply messages.
Operates directly at the network layer without involving TCP or UDP.
Purpose: Test connectivity between two hosts.
Principle: Send multiple ICMP echo requests to the destination host and measure round‑trip time from the timestamps in the replies.
Result: Displays the destination IP address, packets sent/received/lost, and minimum, maximum, and average round‑trip times.
Example scenario with two hosts:
Destination host (PC1): IP = 192.168.1.1
Source host (PC2): IP = 192.168.1.2
6.5 Difference Between Routers and Switches
(Illustrated by the accompanying diagram.)
6.6 Cookie vs Session
Introduction and comparison.
(Diagram illustrating the relationship.)
6.7 Cookie vs Token
Introduction.
Authentication flow based on cookies (illustrated).
Authentication flow based on tokens (illustrated).
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
