Home : Course Map : Chapter 15 :
Chapter 15 : Client/Server with Sockets
JavaTech
Course Map
Chapter 15

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

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

Building on the Web server ideas in Chapter 14, this chapter develops a prototype Data Monitoring Client/Server system using sockets. Later in Chapter 16-21: Distributed Computing we will discuss more elaborate client-sever systems using RMI and CORBA.)

As discussed in Chapter 14, a Web server gets a request from a browser or custom client program, returns the appropriate web page and then breaks the connection ends.. However, the client/server systems discussed in this chapter will instead maintain a connection indefinitely rather than breaking it off as with the web server.

A client session begins with a log-in procedure for the client with the server. Then the server and client set up I/O streams for their communications. As in Chapter 14, multiple clients can connect to the server because it can create a new thread for each new client.

For the log-in, for the exchange of commands, and for the transmission of data, the two programs need a simple protocol so that they can understand one another.

To demonstrate the benefits of such a system, we will create server programs that sends simulated data to clients. We will also create client programs that display the data obtained from the server. The client will provide a graphical interface that lets a user request updated info from the server.

You can easily imagine applications where such a system would be very useful. For example, it could apply to a server running on a system that monitors and even controls an experiment or a sensor in a remote location. Using the client programs, someone could log in from anywhere on the web to check the data, apply new settings, etc. The log-in procedure would allow for secure access to the server.

 

 

 

 

Last 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
21
22 23 24
Supplements

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.