14.3. Example

Below are the codes of simple application server and client. Server waits for a connection from client, reads messages from client, and sends them back. Client connects to the server, reads data from keyboard, sends them to the server, and prints what server returns.