Due date: February 16
In preparation for the two programming projects you might want to get some experience with UNIX network programming, since both projects use the UNIX networking support to send and receive messages. This handout contains a trivial exercise to walk you through the steps involved in sending and receiving network packets under UNIX. This exercise is quite detailed; subsequent handouts will assume this basic knowledge and will not be as detailed.
We expect you to do this exercise on your own before the first recitation section about the lab on Friday February 16. You do not have to hand in anything and you will not receive a grade; however, the projects build on this exercise, so do not skip it. This little exercise should take you at most a couple of hours.
You will be modifying a trivial client/server program. The C sources for the program can be found in the 6033 locker in the subdirectory lab/src/un.
The locker contains 3 files: client.c, server.c, and Makefile. Copy the files to you own locker and type ``make.'' Make will compile client.c, server.c, and create the binaries client and server (type ``add cygnus'' to add gcc to your PATH). Start the server by just typing ``server.'' In another window, type ``client name,'', where name is the name of the machine on which the server is running (i.e., in this the case the machine on which you created the window with the server. (You can find out the name of a machine on which you are logged into by typing ``hostname''.) Every time you run the client, the server will print the notorious C welcome message.
Once you get the programs running, you should study the code and try to comprehend what is going on. You might find it helpful to read chapter 10 (``Communication in distributed systems'') of the Tanenbaum book---one of the 6.033 text books---to obtain a general understanding of client/server programming. The specifics of each UNIX networking call can be looked up in the man pages (e.g., type ``man socket''). If you cannot make sense out of the program using the sources, Tanenbaum, and the man pages, you might want to borrow ``UNIX network programming,'' written by Stevens; or, get in touch with your TA, Dawson Engler.
The programs client and server give you a skeleton to write any client/server program. As the last part of this exercise, write a more interesting client and server. For example, you can turn the server stepwise into a compute server:
There are a couple of pitfalls to watch out for:
6.033 Lab handout 2, issued 2/6/96