$30
CSCE 416 Programming Assignment 2
HTTP Client and Wireshark
In this assignment, you will implement a simple HTTP client and see the HTTP protocol in action using
Wireshark. The client should be able to GET correctly from standard web servers, and Wireshark should be
able to correctly “capture” HTTP GET packet, response packet, and measure the delay between GET and
response packet. Your client doesn’t have to support caching or recursively retrieving embedded objects.
HTTP Client
You should implement your client in a file called HttpClient.java. Your client should run as:
$ java HttpClient http://hostname/path/to/file
for example,
$ java HttpClient http://sc.edu
$ java HttpClient http://cse.sc.edu/somedir/anotherfile.html
You should print the HTTP header information and the content you receive to a file called HttpClientOutput.
Your code should handle http redirects as well, i.e., if a website redirects to another location, then your code
should GET from the new location. For example, http://cse.sc.edu redirects to https://cse.sc.edu.
Wireshark
Wireshark is a packet sniffer tool to debug the networking protocols. We will use this tool to capture HTTP
GET packets, HTTP response packets, and measure the delay between GET and response — while using
the HttpClient that you have implemented. Follow the Wireshark Guide to get started on the Wireshark.
First, run the Wireshark to capture packets from an Ethernet or WiFi interface. Second, apply the filter http
in Wireshark to filter only HTTP packets. Finally, run an instance of your HttpClient program and see the
output of Wireshark. You should take a .jpg snapshot of your Wireshark output when running your code:
$ java HttpClient http://www.google.com; and name the snapshot as HttpClientWireshark.jpg.
We now GET large files and measure how long it takes between the HTTP GET and response packets. Run
$ java HttpClient http://xcal1.vodafone.co.uk/5MB.zip
Look at the timestamps of HTTP GET and response packets in your Wireshark and calculate the delay. Also,
repeat the above for the following instances, and store the delays in the file HttpClientTime.
$ java HttpClient http://xcal1.vodafone.co.uk/10MB.zip
$ java HttpClient http://xcal1.vodafone.co.uk/20MB.zip
Submission
? First, create a zip file containing the HttpClient.java, HttpClientWireshark.jpg, and HttpClienTime;
? Second, rename the zip file as YOURLASTNAME p2.zip (YOURLASTNAME in all caps);
? Third, upload it in the Blackboard.
Grade Breakdown
(1) 10%: You submitted your assignment on-time and the file compiles correctly.
(2) 20%: HttpClientOutput shows the HTTP headers correctly.
(3) 30%: HttpClient can GET the file correctly.
(4) 20%: HttpClientWireshark.jpg file shows the correct HTTP GET and response packets.
(5) 20%: HttpClientTime file shows the correct delays for all large downloads.
1