The material developed for this lab was developed by Prof. L. Felipe Perrone. Permission to reuse this material in parts or in its entirety is granted provided that this “credits” note is not removed. Additional students files associated with this lab, as well as any existing solutions can be provided upon request by e- mail to: perrone[at]bucknell[dot]edu
Read about TCP sockets in your favorite source. The primary goal of this pre-lab is to develop your self-reliance and independent learning skills. Do the best you can to learn the material in advance. You will have an introductory lesson on TCP sockets prior to the lab or in the lab session.
Your goal should be to gain enough knowledge to understand the source code given to you, where two processes establish sockets through which they exchange messages. You can look at Stevens/Rago Ch. 16 (pp. 589-623), Beej’s Guide to Network Programming, or any other source you like.
Create a directory for todays lab, ~/csci315/Labs/Lab4. Copy into it the following files:
These files contain, respectively, the skeletons for an echo server and an echo client. The server is daemon called echod and runs on an arbitrary machine; it receives strings from clients through a TCP socket. The daemon sends back to the client echoreq the same string it received; the client displays the string on its standard output. Read through these files carefully, so that you can understand how the sockets are set up and verify that this is being done correctly.
Create a pre-lab4.txt file, in which you will write answers for this assignment. Label your answers clearly with the name of the questions given to you below.
Problem 1 Read the manual page for the socket(2) call. Compare this call to pipe(2) and open(2); explain the similarities and the differences you observe. (5 points)
Problme 2 Read the code in echod.c and echoreq.c.
Answer the questions clearly in pre-lab4.txt.
When you are done with this, you need to: