CS 154 HW10

Due Wednesday May 26 9pm

I have written a very simple server, which is running on pasta.ci.uchicago.edu at port 15400 (you can hard-code these into your program). Once a client connects to it, the server sends the client a series of short messages (none longer than 100 characters). Write a C program that connects to the server, receives the messages, and prints the contents of the messages (one line per message) to stdout, and exits when the connection is closed by the server. Use the standard system calls we've discussed in class for creating and using sockets.

To submit your solution, put your C code (with enough comments to indicate that you understand what the various functions calls are doing) into a single file client.c and the output of running your program into output.txt. Please hand in these files via your phoenixforge.cs.uchicago.edu account, by using the following commands (you should replace ~/cs154 with whatever you're using as your cs154 phoenixforge directory):

cd ~/cs154
mkdir hw10
svn add hw10
cd hw10
svn add client.c
svn add output.txt
svn ci -m "hw10 solution"