Your assignment is to find me a wonderful unclaimed domain name. You should read the dictionary at /usr/share/dict/words. You should check to see if any of those words are unregistered. For example, "apple" is in the dictionary. You should create "www.apple.com" and attempt to gethostbyname() on the result. List every word in the dictionary that is not claimed.

There are 45,427 words in the dictionary. You might not want to try them all!!!!

The gethostbyname() call can take a long time. You will get higher performance if you can pthread_fork() off multiple clients and run requests in parallel. You can find a discussion of threads at http://www.cet.nau.edu/~mc8/Thread/Hello_World.html and a simple example programs at http://euclid.nmu.edu/~randy/Classes/CS426/Threads There is a pthread tutorial at http://www.llnl.gov/computing/tutorials/workshops/workshop/pthreads/MAIN.html.

You cannot call gethostbyname from within a threaded context. You must call gethostbyname_r. The arguments are ..

    a char pointer to the name to look up
    a pointer to a hostent struct to fill in
    a buffer of bytes for free space
    an int the length of the structure
    a pointer to a pointer to a hostent struct to return the result
    a pointer to an int to return the error code
Points ...
       -0.5 Every day after Sep 16th at 5pm.
	1   Can lookup a single name.
	1   Can thread_fork (must also gethostbyname_r)
	1   Uses gethostbyname_r or the equivelent
	1   Can look up lots of names from the file.
	1   Each thread does more than one lookup before quiting
	1   Uses fine-grained load balancing (not course load balancing)
	1   You can start in the middle of the file.
	1   Can print all the aliases for every found host
	1   Can tell if two hosts have the same IP number
The most you can get is EIGHT points To compile a threaded program you must link against the pthread library. Example: g++ foo.cc -l pthread -o foo