In this sample server sends message (hard-coded) to client. Client shows the message in its console: This message is sent by the Server ... The sample works with 2 console applications SocketServer and SocketClient. Server gets socket descriptor with socket function, creates a socket name by filling sockaddr_in structure, assigns the name to created socket descriptor by bind function and goes into listening state calling listen function. This socket will serve as listening socket. At this point server waits for incoming connections and listen does not return until connection is made up. When client successfully calls connect, listen (on server) returns and server calls accept creating a new socket for the established connection. Before calling accept socket handle for new connection is defined with socket function and sockaddr_in variable is defined, but not filled, for this connection. It is the accept function that actually returns a handle to a socket assosiated with new connection and filles sockaddr_in (though the structure is filled it is not necessary used). Once accept succeeds a server can send a message to a client by send function. Accordingly, client reads the message with recv function (short of receive). Here are steps for making simple client-server communication using blocking sockets in schematic view: SERVER CLIENT ------ ------ - calls socket to open - calls socket to create socket on client listening socket; side to connect, socket-to-socket type, to socket on server; - server socket name is created - client socket name is created by filling sockaddr_in structure; by filling sockaddr_in structure; - listening socket name is bound to socket descriptor by bind function called on server only; - using handle to listening socket the server calls listen to listen for incoming connection from client; - calls connect to establish a connection to server; - once connect is called on client listen returns and server calles accept which returns a new descriptor for a new server socket associated on server with this connection; - using socket descriptor returned by accept, server sends a message to client by calling send; - client reads message from server by calling recv;