For this lab, you need to build a very simple client-server operation using the Unix stream capabilities. This is as described earlier. That is, you are going to communicate between two programs, but they are going to reside on the same host. This is a fairly easy thing to do, but small mistakes can be inordinately difficult to find in communication software. Be careful!

You are to build a client and server pair, to implement your own little directory service. Suppose that the server has the following database

0 Bob
3 Anne
5 Barb
7 Ray
9 Denbigh
10 Terri 104 John

This can be in a file that is read, or it can be a static array in your program - I really don't care about the niceties at this point.

The client is to read a request, which is a numeric address to be sent to the server. The server looks up the matching name and send it back to the client to be printed out. If the address isn't found, the server should send back an error message. For example, "Address not found".

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.