Description
It is often necessary to obtain data from a remote server. Java allows you
to open a TCP/IP connection and talk to a peer on a known port. In order
to demonstrate this a server component has been supplied. The server component
is not running on this Web server. You can download
the server component and run it on a server of your choosing that allows
external WEB access. Many sites have issues with communication on ports other
that those used for standard applications. If that is the case you may
be able to simulate it locally by running the server Java program on your
local machine and using the name of your machine to access it.
The structure of the applet allows you to direct requests to servers
anywhere on the WWW. For example to
provide a stock quoting service you only need to get the data and provide
an implementation of QuoteServerMain that understands the very simple protocol
described in the source code and of course resolve all the legal issues.
This applet uses a number of classes to implement a simple Position/Value requestor.
Java Client that you just downloaded
Java Servers often require permission to talk on other ports
The implementation of a background server is also demonstrated.
to start the background server enter the following command on the server
system after you have compiled the Java source code to a class file.
java QuoteServerMain
This is the random number quote server that will answer requests
if you do not have access to a real server that understands your simple
protocol.