Home : Course Map : Chapter 15 :
The Client/Server Data Monitor: Step by Step
Course Map
Chapter 15

Processing Steps
Data Server
Run Data Server
    Demo 1
Data Client
DataClient Applet
    Demo 2
Client/Server Sim
    Demo 3
Run SimClient
    Demo 4

     About JavaTech
     Codes List
     Topic Index
     Course Guide
     What's New

We show here the essential steps involved in our data client/server system:

We start the DataServer and it sits patiently waiting for clients to arrive. The client starts on another machine (or on the same machine for convenience during testing ) and connects to the server using the socket type connection discussed in Chapter 14:

Diagram 1: Client connects to a server via its server socket.

A simple log-in in procedure occurs in which the server requests that the client send a username. The client responds with a arbitrary name string. You could easily expand this capability to include both a username and password:

Diagram 2: Client & server execute a login procedure..

Another client could also simultaneously request a connection to the server with the same procedure:

Diagram 3: Another client connects to the server.

The server assigns an instance of the Thread subclass called DataWorker whose job is to communicate with a particular client over the socket and to perform the requested tasks.

Similarly, the client creates an instance ofof the Thread subclass DataClientWorker to carry out communications with the server.

Diagram 4: The socket on the client side is assigned a DataClientWorker object to manage the I/O with the server. Similarly, on the server side, a DataWorker to manage I/O with a client.

For an application, the DataWorker might grab data from a file and send it to the DataClient where the DataClientWorker can process it:

Diagram 5: To provide for remote monitoring of an experiment, a sensor, or other system,
the DataWorker class could obtain information from a disk file, run an external program
and read its output, communicate with a sensor via a serial port (see Chapter 23), or use other techniques.

Figure 15.5 illustrates other data taking scenarios such as reading data from an instrument over a serial or parallel port. It could also run an external program and read its output. In Chapter 23 we will discuss how Java programs can reach out to the external world outside of the JVM.

Latest update: Dec. 10, 2004
  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
22 23 24

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.