Take-home exercise: Make a concurrent echo server

In the class, you've seen an example implementation of an echo client server program.

Download the source code here. Compile it in your virtual machine gcc -g echo.c. Start the echo server process by typing

./a.out -s 
Launch an echo client by typing
./a.out
By default, the client connects to the echo server runninging on localhost (127.0.0.0.1) at port 9999.

Exercise 1: While one client is actively connected to the server, start another client (in a different terminal) and observe what happens. Can you explain why?

Exercise 2: Modify the server program's implementation to handle concurrent client connections. (Hint: you may want to use the fork system call and the overall modification shouldn't require more than a few lines of code.)