Systems Programming Homework 6

Systems Programming Homework 6


  1. Modify lclnt2.c and lserv2.c so that they support tickets that include the IP address of the host. Call the resulting files lclnt3.c and lserv3.c. How do you have to change the ticket table? make sure to include changes to the validation function?
  2. In addition, modify lclnt3.c so that it sleeps for 10 seconds and then validates the ticket. If the ticket is valid, the client sleeps for a further 10 seconds and then wraps up. If the ticket is not valid, the client should try to get another ticket. If it succeeds, it proceeds normally. If it fails, it tells the user there has been a problem with the license server and then quits.
  3. A standard method of communicating with servers is by sending signals. This can allow one to print the contents of internal tables or to shut them down cleanly.

    Modify lserv_funcs2.c so it responds to SIGHUP by printing the contents of the table (ticket_array) to standard output, and to SIGQUIT by printing the contents of the table and a message "Shutting down ...", closing the socket and exiting. Call the resulting file lserv_funcs3.c.

    Note that the shut_down procedure closes the socket but is not currently called in lserv2.c. You will need to modify it to ensure that shut_down is called in lserv3.c when the SIGQUIT is received.

    Remember you need to compile this modified version with lserv3.c and dgram.c as in
    cc -o lserv3 lserv3.c lserv_funcs3.c dgram.c

    You can test these features by using the kill command e.g. kill -HUP serverpid where serverpid is the process ID of the licence server.

Turn in the files all the files necessary to compile and run both lserv3 and lclnt3.
Due : Monday May 9, 2016


Paul A. Farrell