Java Tutorial - Java Script : Testing the Server

Java Tutorial - Java Script :

Testing the Server

The TimeServer application must be running for a client to be able to connect to it. To get things started, you must first run the server: java TimeServer The server displays only one line of output if it is running successfully:
TimeServer running ...
With the server running, you can connect to it on port 4415 of your computer using a telnet program.
To run telnet on Windows:
·         On Windows 95, 98, Me, NT, or 2000, click Start, Run to open the Run dialog box, and then type telnet in the Open field and press Enter. A telnet window opens. To make a telnet connection using this program, choose the menu command Connect, Remote System. A Connect dialog box opens. Enter localhost in the Host Name field, enter 4415 in the Port field, and leave the default value—vt100— in the TermType field.
·         On Windows XP or 2003, choose Start, Run to open the Run dialog box; then type telnet to run that program, then type the command open localhost 4415 in the Open field and press Enter.
·         The hostname localhost represents your own machine—the system running the application. You can use it to test server applications before deploying them permanently on the Internet.
Depending on how Internet connections have been configured on your system, you might need to log on to the Internet before a successful socket connection can be made between a telnet client and the TimeServer application.

If the server is on another computer connected to the Internet, you would specify that computer’s hostname or IP address rather than localhost. When you use telnet to make a connection with the TimeServer application, it displays the server’s current time and closes the connection. The output of the telnet program should be something like the following:
Thu Feb 15 22:13:58 EST 2007
Connection to host lost.
Press any key to continue...