uncompres lab1-src.tar.ZThe directory lab1-src contains several files that you will use as base for the webdump program you will implement in this lab.
tar -xvf lab1-src.tar
cd to lab1-src and type "make". You will see two executables: "client" and "server". The server is a time server that can be accesssed by the client provided. First choose a port number for the time server.
Run the time server in one window:
server <port-of-your-choice>In another window run the client:
client localhost <port-of-your-choice>Make sure you use the same port for both the client and the server. The previous commands assume that you are running both the client and the server in the same machine. If you run the client in a different machine, you will need to specify the name of the host where the server is running instead of "localhost".
You will write a command:
webdump <URL>that will request the document described in URL.
A URL has the form:
http://<host>[:port][/file]Webdump will parse the URL to obtain the <host>, <port>, and <file>. If the URL does not have the syntax described webdump will print an error.
If <port> is not specified, the default port number will be 80. If file is not specified the default file will be "/".
GET <sp> /SomePath/SomePage.html <sp> HTTP/1.0 <crlf> <crlf>The sequence <crlf> can be represented as the string sequence "\015\012"where : <sp> stands for a whitespace character and,
<crlf> stands for a carriage return-linefeed pair i.e. a carriage return (ascii character 13)
followed by a linefeed (ascii character 10).
The above request assumes that a connection has been established with a server (for example, the server could be "www.SomeServer.com").
To retrieve the default page from the server instead of specifying a page, issue the following command (Note the '/' in the request):
GET <sp> / <sp> HTTP/1.0 <crlf> <crlf>
To turnin your project type
turnin -c cs422 -p lab1 lab1-srcReading and References
[1] Chapter 25 in `Computer Networks and Internets' by Douglas E. Comer - "Example of a client and a server".
[2] Chapter 07 in `Internetworking with TCP/IP - Vol 3' by Douglas E. Comer and David L. Stevens - "Example client software".
[3] RFC 1945 defines the HTTP 1.0 protocol . You can access this by typing `rfc 1945' on your console.