In this chapter we present two demonstrations of the client/server
paradigm. Here the client/server programs use sockets.
(Later we will discuss RMI and CORBA techniques.)
The goal is to illustrate how one can use Java quickly to build
a client/server system to carry out useful tasks such as transmitting
data from a remote experiment, running diagnostics under the direction
of a client, installing calibration settings, and controlling an
instrument remotely. For demonstration purposes, our servers here
generate simulated data.
We begin with an overview of the client/server with sockets:
The first demonstation involves a simple server whose job is to
provide a set of data to a client on request. The client initially
carries out a log-in procedure with the server and then the server
and client follow a simple protocol for requesting, sending, and
receiving the data.
Both the server and client provide graphical user interfaces (GUI).
The server's GUI displays the status of the communications with
the clients in a text area and also includes some controls (button)
and input fields. The client's GUI has a set of controls and a text
area for communications monitoring plus it includes two histograms
to display the data.
The second demonstration combines the client/server code in the
first example with the physics experiment demonstration of Chapter
9.
The reader can enhance the two client/server programs in many ways
such as suggested in the Exercises
Last update: Dec. 10, 2004
|