4. Client-Server Communication Protocol Design

The client-server communication in this system uses the object serialization technique. Client and server application use socket interface to talk to each other. Default service port is 5500.

The communication protocol is composed of several common object for client and server side. The following paragraphs will introduce these objects.

This is the main object wrapping a request sent from client side to server side. The following is the class definition for this object.

public class RequestObj implements java.io.Serializable {

public final static int GET_USER_INFO=1;

public final static int ADD_EVENT=2;

public final static int DELETE_EVENT=3;

public final static int PROPOSE_MEETING=4;

public final static int GET_ALL_USER=5;

public final static int GET_ALL_EQUIPTYPE=6;

public final static int GET_ALL_ROOM=7;

public int method ;

public UserInfo uInfo ;

public java.util.Date startTime;

public java.util.Date endTime;

public Event evt ;

public MeetingReq mReq ;

}

A request consists of two major part: Method and its related information. Method is represented by constant defined in the RequestObj class.

  1. Get User Info task (method=GET_USER_INFO)
  2. Client send username and password, and get related schedule information for this user.

  3. Add Event task (method=ADD_EVENT)
  4. Add a personal event (evt) for the current user.

  5. Delete Event task (method=DELETE_EVENT)
  6. Delete a personal event (evt) for the current user.

  7. Propose Meeting (method=PROPOSE_MEETING)

Client send request about a proposed meeting and let server to check and schedule a proper meeting time. The meeting requirement is wrapped in a MeetingReq object.

The response from the server to the client is wrapped in the ResponseObj class. Here is the definition for this class:

class ResponseObj implements java.io.Serializable {

public final static int SUCCESS=1;

public final static int INVALID_REQUEST=2;

public final static int INVALID_USERNAME=3;

public final static int INVALID_PASSWORD=4;

public final static int EVENT_CONFLICT=5;

public final static int TIME_CONFLICT=6;

public final static int LOCATION_CONFLICT=7;

public final static int EQUIPMENT_CONFLICT=8;

public final static int UNKNOWN_ERROR=9;

int retCode ;

String msg ;

Vector evtList ;

Vector allUsers;

Vector allTypes;

Vector allRooms;

}

The class include: return code (retCode), error message (msg), and related information for different tasks.

  1. Return Code (retCode)
  2. Code indicating the success and failure of this operation. Values used for this field are among the constant value defined in the ResponseObj class.

  3. Error message (msg)
  4. The error message serve as a more detailed explanation about the reason for the failure.

  5. Event list (evtList)
  6. A event list for a specific user is returned after checking the user name and password.

  7. Username list (allUsers)
  8. A full list of the users’ names is returned upon a GetAllUser request.

  9. Roomname list (allRooms)
  10. A full list of the rooms in the rooms’ names is returned upon a GetAllRoom request.

  11. Equipment type list (allTypes)

A full list of the equipment type names is returned upon a GetEquipType request.