In this lab you will apply what you have learned about network programming to make a networked version of your HaWUp cluster. This document specifies the protocol by which a client should connect to your server. A client will be provided to test your server.
In writing your server, it is important that you conform to this protocol. Failure to do so will prevent the client from communicating with your server, and a crash or failure of some sort will surely ensue. There are two aspects of a protocol that are especially important:
| Description | send | receive |
|---|---|---|
| A single byte | void writeByte(int) | byte readByte() |
| Two-byte integer | void writeShort(int) | short readShort() |
| Four-byte integer | void writeInt(int) | int readInt() |
| Java String | void writeUTF(String) | String readUTF() |
| Server | Client |
|---|---|
| Makes service available at port 3000 and waits for a connection | |
| Connects to the server at port 3000 | |
When a connection is made, spawns a new thread to service the client.
In that thread, send the following:
|
|
| Receives what was sent in the row above | |
Sends the following:
|
|
| Receives what was sent in the row above. | |
Sends one of two messages as a String:
|
|
| Receives what was sent in the row above. | |
Submits a job using one of the following messages:
|
|
| Receives what was sent in the row above. | |
Sends one of two messages as a String:
|
|
| Receives and displays the ok or bye message | |
It is up to the server to take the job and break it into pieces (if possible) to run on the server's nodes.
|
|
| Waits for server to send answer as a String | |
| When answer is ready, send to client as a String | |
| After receiving answer, close connection |
Test your code by first launching your server and then the client. The client prompts for information and submits the job to your server using the specified protocol.
This other person must be on the same network as you to be able to connect.
As given, the sum and rsa code assumes a lower bound that is not part of the specification. You will have to modify those classes in your workspace so that they take in not only an upper bound but also a lower bound.
Note!
- Your server should continue running and accept client after client.
- It should be insensitive to failures (exceptions) thrown on behalf of the client jobs.
When you done with this studio, you must be cleared by the TA to receive credit.
- Commit all your work to your repository!
If you do not commit, the TAs cannot grade your work and you will receive a 0 for this assignment!- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so