Network Programming
Assessment Summary
Weighting 15% of the entire course
Final due date Friday, 1 May 2010 @ 5pm
Type Individual programming assignment
Submission Summary
System
Submission of files to os-2010sp2/$USERNAME/assign2 using the official CVS server for the OS subject
Files
Only *.java files required to run the assignment and your evaluation.txt file Marking
We will be using partially automated marking software, so you must follow these instructions exactly.
Evaluation
You will be required to estimate and justify the grade that you think you deserve for the assignment, based on the marking criteria included. This should be included in the file evaluation.txt in the assign2 directory.
Target platform
The assignment will be marked on cis-lab.ml.unisa.edu.au, make sure your program is able to run on this host.
Specifications
It is very important that you follow the instructions in this document exactly!
The name of the directory you must use in CVS is assign2. Make sure you spell it exactly the same, with the correct case (do not use any upper case letters - Unix is case sensitive!).
Make sure that you test your code on Cis-lab to ensure that it will work for our marking system. Make sure you submit your code early and often.
Your program must be started using the command lines specified later on in this document.
No graphical outputs required. Outputs of both the client and the server are text based.
You must include a text file in plain ASCII called evaluation.txt which contains a written description of what grade you think you deserve, and a justification of why this is so.
Reminder: Please close your client and server once you finish your tests, to free the CPU/memory/port resources for other students. Your process will be killed if you leave them running over 24 hours.
Overview
In this assignment, you will be required to implement client and server programs for a shared white board application. The application requires two components to be implemented, the client and the server. The client allows a user to manually input drawing commands, which is send to the server. The server then takes these messages and sends them to all of the other clients connected to it. The end result is that all clients can see the drawings being entered by the other users, and the server provides the ability to connect them all together.Custom Thesis,Custom Dissertation,请联系QQ:949925041
Program Requirements
You are required to implement a client in Java as a console based application, which is capable of taking inputs from the user and sending them across the network. Messages from the network must be displayed as text on the standard output device. The server must also be implemented in Java, as a simple console based application. You are free to implement your Java code for the client and server in any way that you like, as long as it meets the following guidelines:#p#分页标题#e#
It must run on Cis-lab using only standard JDK classes and no other external classes
The server should not have any user interface but may print out text debugging
You must use the network protocol and ports that we have specified in this document
You must use the supplied command lines to start up your client and server
This assignment is broken up into two parts, the client and the server. We will provide a server that implements the protocol specified in this document which you can use to test your client against while you are developing it. The provided server will also be useful to allow you to test your assignment with other students who are testing at the same time. When your client is working, you can then use it to test out the server that you have implemented yourself.
Network Protocol
The protocol that is used in this assignment is based on a simple text format to make it easy to implement and debug and problems. Messages are sent over a TCP connection to guarantee reliability and delivery, and also to provide a simple transmission mechanism similar to writing to a file. Each message is sent as a command followed by the required arguments, using a single space character as a separator and a new line character to end the command. Note that the client can exit by simply closing the connection to the server, and the server must handle this cleanly. There are a set of protocol messages that you will be required to implement.
Client to server messages
LOGIN [username]
The client sends this message to the server when it initially connects. The server will not process any other messages nor allow the client to see any drawing messages until this message has been processed. The username must contain only the letters A-Z, a-z, or the digits 0-9, any other characters such as punctuation or spaces are not allowed. The server must check to ensure that usernames are unique, so that no two clients may connect with the same user name.
DRAW [x1] [y1] [x2] [y2] [colourname]
Server to client messages
WELCOME [any other data may go here]
This message is sent by the server when a new client connects to it. The welcome message may contain a string containing any number of characters including spaces. You may put whateverwelcome message you would like clients to see, and would typically include your name and any other descriptive text. The client must display this text so the user knows what server they have connected to.
LOGIN_OK
This message is sent by the server when it has received the LOGIN command from the client. It indicates that the server is now ready to accept DRAW commands from the client, and will pass on messages from other clients.
DRAWMSG [username] [x1] [y1] [x2] [y2] [colourname]
This message is sent by the server whenever a client sends a DRAW message to it. The server is responsible for working out the username of the client connected to it that generated the DRAW message, and then generating a new message which is sent to all of the clients. Note that this message is sent to all of the clients, including the client that generated it. The coordinates and colours are specified in the same way as the previous DRAW message.#p#分页标题#e#Custom Thesis,Custom Dissertation,请联系QQ:949925041
ERROR [reason string]
If the server does not understand a message that the client sent to it, the server should generate an error message so that the client can print this out for debugging. This will be useful as you test your client and server against those written by others. The reason string must be a single line of text and can contain any characters including spaces - it should be descriptive enough so that the remote client programmer knows what their program has done wrong. Some example messages could be:
ERROR Cannot accept DRAW command until after LOGIN request ERROR DRAW command contains a value which is out of bounds ERROR The supplied username is already in use
After generating an ERROR message, the server should close the connection and not try to continue processing because there is an error in the protocol implementation (probably caused by the client, although this is assuming the server does not have any bugs in the code). Note that if the server fails then it may simply close the connection without any response, and the client should then terminate with an error message.
Protocol ordering
When a client connects to the server, messages will be sent back and forth in the following order. Any other order is not supported. Note that the server is not required to store drawing commands internally, so if a client joins the server later than other clients, it will miss out on any lines drawn beforehand. An ERROR message may occur at any time and after this the server automatically closes the connection. The startup sequence is as follows:
相关文章
UKthesis provides an online writing service for all types of academic writing. Check out some of them and don't hesitate to place your order.