This homework assignment involves writing a multithreaded name service client-server application. In this application, the client will write an IP name (i.e. www.geni.net) and the server will respond to the client with the IP address (i.e. 128.163.140.180).
DNS (Domain Name System) is used to resolve IP names to actual IP addresses. The following program illustrates how DNS can be used:
Usage:
java DNSLookUp < host >
This server will operate as follows:
If the server cannot resolve the IP name to an address, it will write the message Unknown Host followed by a newline \r\n.
The client will be passed two parameters:
1. The IP address the server is running on (i.e. localhost, although it could also be a server running on another machine.)
2. The IP name to be resolved.
As an example:
java DNSClient localhost www.westminstercollege.edu
Where the client writes the corresponding IP address it read from the server:
146.86.4.37
If the client were to enter an invalid IP name, such as:
java DNSClient localhost www.nosuchcollege.edu
The server would return the message
Unknown Host
and the client would display this message it received from the server.
Standard error checking applies:
Additionally, it is important that your program only return the IP address, or the message Unknown Host. No other messages should be returned to the client.