CN Exp2
CN Exp2
Socket programming is a way to enable communication between two systems over a network. It is a
crucial part of network communication in many applications, including web servers, chat
applications, and file transfer protocols.
The Client-Server model is one of the most common models in socket programming, where one
machine (the server) listens for requests, and another machine (the client) sends requests to the
server.
Client-Server Architecture:
• Client: Connects to the server at a specific IP and port, sends requests, and receives
responses.
Explanation:
1. Server Code:
o Once a connection is established, the server receives data, processes it (in this case,
converting to uppercase), and sends the response back to the client.
2. Client Code:
o The client creates a socket and connects to the server at the specified IP and port
using connect().
o It sends a message to the server and waits for a response. If the message is "bye",
the connection is closed.