oval
Centre International de Mathİmatiques Pures et Appliquİes
International Center for Pure and Applied Mathematics
A CIMPA-UNSA-INRIA-UNESCO-VIETNAM SCHOOL ON
Objects and Network
Client/Server Exercises
Emmanuel Chailloux
Emmanuel.Chailloux@lip6.fr
http://www-spi.lip6.fr/~emmanuel
Exercises : Client/Server
- Test some Internet services
- Test and modify the CAPITALIZER server
- Test and modify the HTTP reader
- Adapt the Producer-Consumer
- Adapt the World of robots
Exercises
To try some Internet services
HTTP protocol and HTML language
- to run an HTML browser, and read a page from the local server.
- to put on your page your applet from Exercise 1.1
Telnet
The Telnet program
(for remote connections) allows also to connect himself on another port
(for exemple port 80 to connect you on an HTTP server). The command syntax is :
c:\windows\telnet http-server 80
At this moment, you can send to the HTTP server an HTTP request.
You need to configure the telnet application in order to see a local echo and to save the answer on a log file.
- to try a GET request : GET index.html HTTP/1.0 <CrLf> <CrLf>
- to try a HEAD request : HEAD index.html HTTP/1.0 <CrLf> <CrLf>
Traceroute
The windows command tracert corresponds to the Unix command traceroute which indicates the route between your computer and the computer target.
- To try to trace some local addresses
- To try to trace some local names
- To try to trace outside addresses and names.
CAPITALIZER server
To Write it ans to test it with several clients, on the same machine and on different machines.
Some Sources
HTTP reader
-
To modify the HTTP reader in order to accept different kinds of HTTP requests.
To try it with a HEAD request.
- To parse the answer to recuperate all the images URL. HTML simplified syntax for images is the following :
<IMG SRC="path1/path2/name">
To keep a URL list for images.
- How can you visualize this list?
Some Sources
To adapt the Producer/Consumer
The shop becomes a server. There are two kinds of clients : Producer and Consumer. Each client will be manage by a
thread on the server.
-
To define a small protocol to put and to get a product from the shop.
You need to define also an acknowledgment to confirm to the Producer
that its product will be well received by the server. A product can be viewed as a number.
To adapt the robots world
The world, where robots move, becomes the server. Each robot is a client.
You need to define a protocol between server and clients.
This protocol must manage :
- free positions from a position
- robot movements
- acknowledgment for robot movement.
The server will display the world state in text or graphic mode.
- To define the communication protocol.
- To write the server.
- To write a basic client (for example the random robot).
- To test them with three clients.
- To define others kinds of clients and to test them.
Example of using JDBC
A small example, which gets a connection to a ``yellow pages'' database.
The {\tt{Access} class can send a ``generic'' request to the database.