Computer Communications Fall 1998
Project 4 [due 23 November]
This project asks you to write a C program communicating with a WWW server. Your task is to write the chekword command that fetches a specified web page and determines whether or not it contains a given character string anywhere in the web page's text.
The syntax of executing your program should be
chekword URL textwhich communicates with a specified WWW server (known from the URL) and tests to see if the page given by the URL has the given text or not. For instance,
chekword "http://www.cs.uiowa.edu/index.html" hourswould produce the answer "Yes" whereas
chekword "http://www.cs.uiowa.edu/index.html" bingowould return the answer "No" because the word bingo does not appear on the CS department's web page.
You'll need to know the following to complete the assignment.
telnet www.cs.uiowa.edu 80and enter an http message, such as GET /~herman/22C178/index.html and watch the response. Note: when you send such a message in your C program, remember to end it with a "\n" character so that the WWW server knows where your command string ends.
The program tcpcli.c is the ``client'' of the example. This program reads from standard input (the terminal) and sends a TCP data stream to a server. You should be able to compile this program and test it with the corresponding server program, tcpserv.c in the same machine (it uses localhost as the network address). To run these programs, follow these steps.
gcc -o tcpcli tcpcli.c
gcc -o tcpserv tcpserv.c
Of course, for this project, you don't need to write a server program --- the WWW server already exists! But you can use these TCP examples to prepare other projects.
What to Turn In
Submit your program source by email so that we can compile it, test it, and verify that it works correctly. Mail the program to email@example.com and specify in the subject line, the course number, the project number and the last four digits of your student ID number (we are hoping that four digits will be unique). So, for example if your student number is 123456789, then the subject line of your email should be:
178 project 4, student 6789If you do not have such a subject line, I will bounce the mail back to you for resubmission.
This project counts 150 points maximum. We are not looking for expert programming here, just a program that works for various cases. We will test to see that it does not abort if given no command parameters, or only one parameter; we will test it with two parameters; we will test it with a variety of different web pages and character strings.