Discussion questions: programming with sockets

Please work out these problems before your next discussion section. The GSIs and IAs will go over these problems during the discussion section.

1. Socket Programming

You will use sockets in Project 4 to facilitate communication between a client and the network file server you will write. This exercise will serve to give you practice using the various socket functions for both the client and the server.

First, read the socket programming tutorial linked to from the course webpage.

Then, write a simple client and server, where the client sends a string to the server, the server outputs the string using cout, and then sends some acknowledgement response back to the client.

Use TCP by specifying options AF_INET and SOCK_STREAM when calling socket(). Use send() in the client to send data, and recv() in the server to receive it.