ICT 4361 — Java Programming Exercise 7

Purpose

This exercise familiarizes you with the basic methods of the networking APIs in Java, and simple tasks such as reading the contents of a URL, and writing on a socket. This will also exercise your knowledge of Exceptions.

What To Hand In:

Please hand in a listing for each program requested, formatted in an easy-to-read style.

Ensure your name, and the name of the file is available in a comment at the top of the file.

Also, ensure that you have a sample of the output from the program.

If your program fails to compile, hand in your error listing as your output.

For each question asked, provide one or two sentences summarizing your answer. Please be both complete and succinct.

Problems

For the last problem, you will want to download hw7.jar This file contains the class files and source for a server process.

  1. Create a class called ReadURL which has the following features: Note that there are exceptions which may be created as a result of these assigments, which you should handle in the constructor Note that Exception handling is necessary in these methods as well.
  2. Create a new class with just a main method to do the following:
  3. Create a new class called WriteURI with the following features:

Notes

  1. Exception handling is an important part of this exercise
  2. To run the SimpleServer from the command line in Windows, do the following:
  3. You may use your ReadURL class to get the server host and port information, or you may examine the file, and then code its contents into your program
  4. Note that hw7.jar contains the source for the server, as well as the class files, so you may examine this if you wish

Evaluation Criteria:

CriteriaWeight
Problem 135
Problem 230
Problem 335