Java removes much of the complexity of writing Network aware applications, by providing a We are going to write a finger client to demonstrate how TCP works in Java. Finger is a standard service that allows a remote machine to query a server and ask it for information on a particular user, or on the users that are logged on. Most UNIX systems support finger, however on many server systems it is disabled, as it provides a little bit too much information for potential 'hackers'. The host server is usually located at port 79, where a request is usually made up of a username followed by the '\n' character. The server sends any information back to the client and then terminates the connection. Here is the source for
When the Finger application is run it expects the name of a user@host, either specified by the full Internet name, or the name of a machine on the same network segment. If you forget to provide the parameters, it prompts you for the correct parameters (See Figure 7.3, “Finger Client Example”) I have run the finger application three times in Figure 7.3, “Finger Client Example”. The first time I omitted the parameter by typing java Finger and I was then prompted for the correct parameter. In the second case I typed java Finger molloyd@khumbu.eeng.dcu.ie and this searches for the username The Finger application consists of three main steps:
Figure 7.4 Executing the Finger Client Application (Executed in 2013) Another example of a client application is a basic web browser. This application allows you to connect to any web server (depending on your proxy) and request a web page. The result is returned in HTML and displayed in the text area as shown below This application connects to a web site on port 80 and sends the string: where Here is the source for
These notes are copyright Dr. Derek Molloy, School of Electronic Engineering, Dublin City University, Ireland 2013-present. Please contact him directly before reproducing any of the content in any way. |