Case Study: Internet Access
These are the exact programs that I used in class on Thursday 8th
April 1999. They compile perfectly on rabbit. For other unix computers
you may have to change some of the include directives in includes.h,
but everything else should remain the same.
If you download them, you'll have to change their names slightly; I
had to make them all end in ".txt" so that web browsers don't try
to do stupid things with them.
To compile, you go through the following steps:
CC -c internet.cpp
CC -c internet_client.cpp
CC -c internet_server.cpp
CC -c client.cpp
CC -c server.cpp
CC client.o internet_client.o internet.o -o client
CC server.o internet_server.o internet.o -o server
To run the server in the background, type
server &
and note down the port number it tells you. To run the client, type
client rabbit.eng.miami.edu 1234
Of course, substituting the correct port number for 1234, and the correct
computer name if you're not on rabbit.
REMEMBER when you log out to kill the server process. To do
this, type
ps
and note down the "process id" numbers of all the processes running
your server. Then for each, type
kill -9 3456
substituting the appropriate process number for 3456 of course.
If you want the ugly C version that we looked at first, here are
server.c
and client.c, and
an explanation of how they work.