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!
As is quite appropriate, the first experiments
in the book call for modifications to programs
available from Purdue University.
The directions for obtaining the software are
found on the second page of the introduction to this chapter.
You may wish to do this
yourself and make the materials available
to your student at your school.
Note that the solutions for Experiment 5.1
are contained in
the /ch5/exp5.2
directory.
Experiment 5.1 requires the students to compile
and test an echo client. It is possible that
the procedure will not be completely transparent
to some students (it takes a few minutes thought
to see how things are organized), but detailed
directions are to be found on the page for this
experiment. The Optional Extensions are interesting
and are not difficult. I would encourage students
to perform further experiments such as the one
described on the page. Anytime you encounter
"odd" behavior, it is good to call attention to
and seek an explanation. It is also interesting
to compare the behavior of software that a student
writes with "the real thing", and then to ask what
it would take to write it the real way.
Experiment 5.2 requires adding some features.
This requires familiarity with the basic string
handling functions in C
. The first
Optional Extension is of great interest. The comment
that "Sending the remote user's name with each line
of text wastes network bandwidth" is of special interest.
Expect the objection, "So sending David costs an extra
6 bytes? Why worry about 6 bytes?" It is the principle!
Watch out for the second Optional Extension. It
is, in my opinion, extremely difficult. See the page
for this experiment for details. As best as I can tell
at the moment (I plan to come back to this one once I
am further along), changing the terminal settings require
modification to the library code provided. Nasty, but
challenging. For some students this is the way to go.
What I plan to do next time around is postpone this
extension until Experiment 6.2. I will also change 6.2
to require a chat client/server instead of
an echo client/server. This is the way I did it,
and I found that in that context it is easier, but
certainly not too easy. It is a great exercise!
Experiment 5.3 introduces the student to file transfer.
This idea will appear again in Experiment 6.3, and then
again in Expriments 8.3 and 8.4. It so happens that
I had done both of those previously, so the solutions
do not contain code for this experiment, but it is easy
to do.
This site is maintained by W. David Laverell
of the Computer Science Department
at Calvin College. For assistance or corrections,
please contact him at .