Homework 3


15%, due Apr. 16

Use a word processor for the non-programming exercises. Use a paper clip to keep everything together. Late assignments will be accepted only if an extension is granted before the day the homework is due (This policy will apply to all further work.).

  1. Write a pair of client/server programs which transfer files between one machine and another.

    The server program should listen on a port number above 5000 (pick one randomly) for connection requests.

    The client program makes the connection request and transmits filename/file pairs. The syntax of the client program's command line should be:

    client serverhost file1 file2 ...
    The client will attempt to connect to the server running on serverhost. An algorithm for transferring the files is:
    while there are files
       let current be name of next file
       if current can be opened for reading in the present directory
          if successful in opening connection with server
             send current's name over, terminated with '\n'
             send current over
             close connection
    A server algorithm:
    loop forever
       wait for next connection
       let current be the name of the file to be transferred
       if current can be opened for writing in the present directory
          write current until the connection is closed
    You'll have to interrupt the server ( ctrl-c) to terminate it.

    You will have to decide how to intelligently deal with error conditions, such as the server not being able to open a file for writing.

    At the beginning of class on the 16th, hand in the source code for your client and server programs. In order that I can verify that your programs work and appropriately handle error conditions, you will demo you programs to me during the week of the 15th. You may demo it during my normal office hours or make an appointment to do so.

Thomas P. Kelliher
Mon Mar 25 08:21:15 EST 1996
Tom Kelliher