CS 3733 Operating Systems, Spring 2008 Recitation Sessions 11 and 12


April 11 and 18
In this session you prepare for Assignment 6.

  1. Create a Rec11 directory.
  2. Copy all of the files from your Rec10 directory into the Rec11 directory.
    If you did not do Recitation 10, download this tar file of the programs from Chapter 18 and untar it into your Rec11 directory.
    Execute the convertlinux script.
    This modifies the makefile to include -D_GNU_SOURCE and remove the reference to -lsocket during compilation.
  3. Use make to compile all of the programs.
  4. Copy serverp.c into factor_server.c and add lines to the makefile to compile this program.
    Make sure factor_server.c can communicate with client2 as before.
  5. Modify factor_server.c so that instead of having the child call copyfile it calls your function find_factors.
    This function, which you will write, takes a single parameter, the communication file descriptor for the connection.
  6. find_factors will read 3 long long values from the network.
    These values will be in the form of ASCII digits, high digit first, with the numbers separated by a single blank.
    You may assume that the third number also has a trailing blank and all numbers are fewer than 20 digits.
    Store these three numbers in long long variables called n, low, and high.
  7. Print these numbers out to make sure they are correct.
  8. Now find all factors (including repeats) of n between low and high, inclusive.
  9. Print out the factors as you find them.
  10. Now modify the program so that it sends each factor back to the client in the same format as it was read, as ASCII digits followed by a blank.
    When there are no more factors to be found, close the connection.
  11. When you think you have this working, come to the board and write your host name and port number.
    I will test your program by sending it some data.
  12. Make sure you sign the signout sheet before you leave, even if you do not get your program working.