Apache Commons Net
Apache Commons Net™ library implements the client side of many basic
Internet protocols. The purpose of the library is to provide
fundamental protocol access, not higher-level
abstractions. Therefore, some of the design violates
object-oriented design principles. Our philosophy is to make the
global functionality of a protocol accessible (e.g., TFTP send
file and receive file) when possible, but also provide access to
the fundamental protocols where applicable so that the programmer
may construct his own custom implementations (e.g, the TFTP
packet classes and the TFTP packet send and receive methods are
exposed).
Features
Supported protocols include:
- FTP/FTPS
- FTP over HTTP (experimental)
- NNTP
- SMTP(S)
- POP3(S)
- IMAP(S)
- Telnet
- TFTP
- Finger
- Whois
- rexec/rcmd/rlogin
- Time (rdate) and Daytime
- Echo
- Discard
- NTP/SNTP
Background
Apache Jakarta Commons Net started as a commercial Java library called
NetComponents, originally developed by ORO, Inc. in the early
days of Java. After its 1.3.8 release in 1998, the source code was
donated to the Apache Software Foundation and made available under
the Apache License. Since then, many programmers have contributed
to the continued development of Jakarta Commons Net. The current
version numbering scheme bears no relation to the old. In other
words, Jakarta Commons Net 1.0 succeeded and supplanted
NetComponents 1.3.8.
Apache Jakarta Commons is now an independent project and is called Apache Commons.
Examples
Commons NET includes several working sample applications that you can use.
Source files are included in the source (and binary) archives, and a compiled jar is provided.
To use one of the sample applications, ensure that the example and main jars are both in the same directory.
Then run the class as per the following example:
java -jar [path/]commons-net-examples-3.8.0.jar FTPClientExample [parameters]
This uses the helper application which supports shorthand class names.
Alternatively, ensure that the example and main jars are on the classpath.
Then invoke the class directly, for example:
java -cp commons-net-examples-3.8.0.jar;commons-net-3.8.0.jar examples/ftp/FTPClientExample [parameters]
FTP (package: examples/ftp)
- FTPClientExample
demonstrates file download and upload, LIST, MLST etc over FTP(S) and FTP over HTTP
- ServerToServerFTP
This program arranges a server to server file transfer that transfers a file from host1 to host2.
- TFTPExample
This is an example of a simple Java tftp client
MAIL (package: examples/mail)
- IMAPMail
This is an example program demonstrating how to use the IMAP[S]Client class.
- POP3Mail
This is an example program demonstrating how to use the POP3[S]Client class.
- SMTPMail
This is an example program demonstrating how to use the SMTP[S]Client class.
NNTP (package: examples/nntp)
- ArticleReader
Simple class showing one way to read an article header and body.
- ExtendedNNTPOps
Simple class showing some of the extended commands (AUTH, XOVER, LIST ACTIVE)
- ListNewsgroups
This is a simple example using the NNTP package to approximate the
Unix newsgroups command. It connects to the specified news
server and issues fetches the list of newsgroups stored by the server.
On servers that store a lot of newsgroups, this command can take a very
long time (listing upwards of 30,000 groups).
- MessageThreading
Sample program demonstrating the use of article iteration and threading.
- PostMessage
This is an example program using the NNTP package to post an article to the specified newsgroup(s).
It prompts you for header information and a filename to post.
NTP (package: examples/ntp)
- NTPClient
This is an example program demonstrating how to use the NTPUDPClient
class. This program sends a Datagram client request packet to a
Network time Protocol (NTP) service port on a specified server,
retrieves the time, and prints it to standard output along with
the fields from the NTP message header (e.g. stratum level, reference id,
poll interval, root delay, mode, ...)
- TimeClient
This is an example program demonstrating how to use the TimeTCPClient
and TimeUDPClient classes.
This program connects to the default time service port of a
specified server, retrieves the time, and prints it to standard output.
TELNET (package: examples/telnet)
- TelnetClientExample
This is a simple example of use of TelnetClient.
- WeatherTelnet
This is an example of a trivial use of the TelnetClient class.
It 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.
Unix utilities (package: examples/unix)
- chargen
This is a simple example of use of chargen.
- daytime
This is a simple example of use of daytime.
- echo
This is a simple example of use of echo.
- finger
This is a simple example of use of finger.
- fwhois
This is a simple example of use of fwhois.
- rdate
This is a simple example of use of rdate.
- rexec
This is a simple example of use of rexec.
- rlogin
This is a simple example of use of rlogin.
- rshell
This is a simple example of use of rshell.
|