Client-Server Project Initial Design Considerations


Project Specification

The remainder of this chapter will focus on the construction of a multi-threaded client-server application that satisfies the requirements as set forth in the project specification given in table 20-1.

Table 20-1: Client-Server Project Specification

Project Specification

Client-Server Application

Objectives:

- Utilize the ServerSocket, Socket, DataInputStream, and DataOutputStream classes in a client-server application.

- Utilize the Thread class to create a multi-threaded server application.

- Demonstrate your ability to create and implement custom application protocols.

- Demonstrate your ability to translate custom application protocols into actions executed by the server application.

- Utilize Remote Method Invocation (RMI) to implement a client-server application.

Tasks:

- General Description: Write a client-server application that allows you to remotely control the movements of a robot rat around a floor. A user must be able to connect to the server via a client application and control the movements of a robot rat that is associated with that client session. Give users the ability to move their robot rat in the following directions: N, NE, E, SE, S, SW, W, and NW.

- Server Specification: The server application must be capable of handling socket-based and RMI-based client connections simultaneously. The socket-based portion of the server application must process client communications in a separate thread. The server must display an image of a user’s robot rat upon the floor and update the location of the robot rat image as the user moves it about the floor.

- Client Specification: Users interact with the robot rat server via a client application. You must implement two client applications: 1. an RMI-based client, and 2) a socket-based client. You may optionally combine the two client applications if you desire. Give the client application a graphical user interface utilizing Swing components. The user interface might take the form of a 3 x 3 grid of JButtons that allows users to easily send directional move commands to their robot rats. You must also allow users to specify the URL or IP address of the robot rat server when they start up the client application.

- Resources: You may use the following image for the robot rats if you desire:

image from book
Figure 20-9: rat.gif

The image from book rat.gif image can be found on the companion CD in the NetRatServer project folder.

- Hints: Attack this project according to the project approach strategy. Carefully analyze the project specification and formulate a rough design and implementation approach. Implement the project in stages, starting with a subset of the server application functionality. Continue the design-build-test cycle until you have completed the project.

Look at the Canvas class as a foundation for the robot rat floor. Implement the rat as a stand-alone class that contains its image and its position upon the floor.

As you can tell from reading the project specification this is no small project. The server application must provide the capability to process service requests from socket-based and RMI-based client applications simultaneously. The socket-based portion of the server code must be multi-threaded. This means that when the server detects an incoming socket-based client connection it must pass off that connection to a separate thread for processing. Given the complexity of this application it will be helpful to spend time discussing in greater detail some of the issues surrounding its possible design.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net