NOTE: for the necessary network rights the client/server code needs to be compiled/run on the pups, not otter. |
I will supply a simple client and server, client.C and server.C.
The client simply sends a sequence of messages to the server until the user decides to quit. The server listens for incoming messages and displays them until the admin decides to quit.
The objectives for the lab are:
If the client sends a message that requires acknowledgement they should immediately stop and listen for the ack.
We'll have the client set up a socket for listening (since eventually they'll be listening for more than just acks), which means choosing a port number and ensuring the server knows which port to reply to.
If the server receives a message that requires acknowledgement they should immediately send one.
Note 1: this will involve adding sending code to the server and receiving code to the client.
Note 2: because (so far) we are using blocking receives, if an 'R' or 'A' message is lost then communication between the two is deadlocked: the client is waiting for an acknowledgement that will never arrive. We'll address this problem in next week's lab.
Note 3: because (so far) we are also using blocking keyboard input, the sequence of events is pretty constrained (alternating between getting a user command and then sending/receiving). Again, we'll address this in next week's lab.