Alert! A problem has emerged with the experiments in this
chapter! Many thanks to Professor Cozart of Mercer University
for bringing it to my attention.
It is a UNIX problem only (so far)!
If you are using a 64-bit computer with an up to date
compiler, echoserver will always terminate.
I have let Professor Comer know about this, but for the
time being here is a quick fix.
In the directory h there is a file named cnaipi.h.
On line 26 of this file there is a line that says typedef
long computer. Just change long to int,
and and the echo and chat software will work fine.
You might want to change long to int on line
43 of cname_to_comp.c in the api directory to avoid
some warnings. Many thanks to Dr. Cozart!
The procedure for compiling and linking the client
and the server is described in the excellent README file that
comes with the software. For convenience here is a summary.
If you are using
a unix machine, you should do the following:
- create a directory for the experiment, say exp5.1.
- place CNAI.api.tar in that directory.
- cd to the directory exp5.1.
- type "tar xvf CNAI.api.tar".
- cd to either compile_linux or compile_solaris.
- type "make echoclient".
- echoclient is now in the compile_xxx directory.
In my own experience echo service is not quite
"standard throughout the internet". In the name of
security many network administrators have turned off
what they regard as non-essential services. Often
this includes echo service. To test your echo client
use cs.purdue.edu.
The Optional Extensions are quite interesting. Number 10 is
easier requiring only a forever loop (for testing it might be
more convenient to use a for loop to handle a small number of
connections). You just have to figure out where to put it.
Number 9 is only slightly harder. You have to open a file,
repeatedly write whatever comes in to that file, and
eventually close the file.
You now have a working echo client and server so you might as
well experiment. Try connecting from two different machines at
the same time. Execute your server, execute a client, and
execute a client from a different host (or window). Notice the
behavior of the server as it gets intermingled messages from
two hosts. Examine the log file to verify that the observed
behavior is reflected in the log. Now come up with an
explanation for this
somewhat unexpected behavior.
This site is maintained by W. David Laverell
of the Computer Science Department
at Calvin College. For assistance or corrections,
please contact him at .