Learn about the client-server model, TCP vs. UDP, IPs, and ports.
At the heart of most network communication is the client-server model. A **server** is a program that provides a service by listening for incoming network requests. A **client** is a program that connects to a server to use that service. To communicate, they need an address. This is provided by the Internet Protocol (IP), which gives every device on a network a unique **IP address**. However, a single device might be running multiple server applications (e.g., a web server and a database server). To differentiate between them, we use **ports**. A port is just a 16-bit number (0-65535) that identifies a specific application or process. The combination of an IP address and a port number creates a unique endpoint for communication. Data is transmitted using a transport protocol. The most common is **TCP (Transmission Control Protocol)**. It's 'connection-oriented', meaning it establishes a reliable, two-way communication channel between the client and server. It guarantees that data arrives in order and without errors by retransmitting lost packets. This makes it ideal for web browsing, file transfers, and email. The other major protocol is **UDP (User Datagram Protocol)**. It is 'connectionless' and does not guarantee delivery or order. It simply sends packets ('datagrams') and hopes for the best. This lack of overhead makes it much faster, so it's used for applications where speed is more critical than perfect reliability, such as online gaming, video streaming, and DNS lookups.