What Is examples.telnet.WeatherTelnet.java

Q

What is examples.telnet.WeatherTelnet.java?

✍: FYIcenter.com

A

examples.telnet.WeatherTelnet.java is an example program of a trivial use of the TelnetClient class.

examples.telnet.WeatherTelnet.java connects to the weather server at the University of Michigan, um-weather.sprl.umich.edu port 3000, and allows the user to interact with the server via standard input.

You could use this example to connect to any telnet server, but it is obviously not general purpose because it reads from standard input a line at a time, making it inconvenient for use with a remote interactive shell.

The TelnetClient class used by itself is mostly intended for automating access to telnet resources rather than interactive use.

You can follow these steps to download, view and run examples.telnet.WeatherTelnet.java program.

1. Download commons-net-3.5-bin.zip file from Apache Commons Net.

2. Unzip all files from commons-net-3.5-bin.zip, and install them to C:\local. You should see C:\local\commons-net-3.5 folder with two JAR files and "examples" sub folder:

05/01/2016  11:37 PM           303,658 commons-net-3.5.jar
05/01/2016  11:37 PM            82,453 commons-net-examples-3.5.jar
05/01/2016  11:37 PM    <DIR>          examples

3. View C:\local\commons-net-3.5\examples\telnet\WeatherTelnet.java with a text editor.

4. Run WeatherTelnet.java in command window with both JAR files included in the classpath:

C:\fyicenter> java 
   -cp .;C:\local\commons-net-3.5\commons-net-3.5.jar
        ;C:\local\commons-net-3.5\commons-net-examples-3.5.jar 
   examples.telnet.WeatherTelnet

------------------------------------------------------------------------------
*               Welcome to THE WEATHER UNDERGROUND telnet service!           *
------------------------------------------------------------------------------
*                                                                            *
*   National Weather Service information provided by Alden Electronics, Inc. *
*    and updated each minute as reports come in over our data feed.          *
*                                                                            *
*   **Note: If you cannot get past this opening screen, you must use a       *
*   different version of the "telnet" program--some of the ones for IBM      *
*   compatible PC's have a bug that prevents proper connection.              *
*                                                                            *
*           comments: jmasters@wunderground.com                              *
------------------------------------------------------------------------------

Press Return to continue: <Ctr-C>
Terminate batch job (Y/N)? y

 

P.E.I Weather from examples.telnet.WeatherTelnet.java

Download FTP File with FTPClientExample.java

Using commons-net.jar in Java Programs

⇑⇑ FAQ for Apache commons-net.jar

2017-05-05, 2998🔥, 0💬