A client is a process that starts a conversation with a server. It connects, sends a request or message, receives any response, and eventually disconnects. A web browser talking to a web server and an email program talking to an email server follow this pattern. section 10.2
A client-server exchange usually follows these steps:
- Connect to the server through a network socket. section 10.2 section 10.3
- Target the server's IP address and listening port, which identify the host and application entry point. section 10.3
- Send a message containing the requested service or data. section 10.2 section 10.3
- Read the server's response, then close the connection when the exchange is complete. section 10.2
Ordering pizza from a local server
A pizza-ordering client connects to 127.0.0.1 on port 12345, sends a quantity such as 10, and receives “Thank you for ordering 10 pizzas!” The same exchange can be tested with Netcat on UNIX/macOS or ncat on Windows. section 10.4
Visualizes how a client connects to a server and exchanges messages through sockets. section 10.2














