Beispiel #1
0
 /** Method sends a Close message to the server returns 1 on success */
 public CTPResponse Close() {
   // request
   Close close = new Close();
   CTPResponse response = sMachine.Process(sMachine.SENDING, close);
   close(); // now close the socket
   return response;
 }
Beispiel #2
0
 /**
  * Method sends a Sync message to the server request a status message returns 1 on success 0 on a
  * failed response from server -1 on a invalid request to the state machine
  */
 public CTPResponse Sync() {
   Sync sync = new Sync(clientID);
   return sMachine.Process(sMachine.SENDING, sync);
 }
Beispiel #3
0
 /**
  * Method requests the contents of a file returns 1 on success 0 on a failed response from server
  * -1 on a invalid request to the state machine
  */
 public CTPResponse ReqContents(int cursorLoc, int size) {
   ReqContents req = new ReqContents(clientID, cursorLoc, size);
   return sMachine.Process(sMachine.SENDING, req);
 }
Beispiel #4
0
 /**
  * Method sends a MOVE message to the server indicating the new position returns 1 on success 0 on
  * a failed response from server -1 on a invalid request to the state machine
  */
 public CTPResponse Move(int cursorPos) {
   Move move = new Move(clientID, cursorPos);
   return sMachine.Process(sMachine.SENDING, move);
 }
Beispiel #5
0
 /**
  * Method requests the file lock be release from the server requires that this client have
  * ownership of the lock returns 1 on success 0 on a failed response from server -1 on a invalid
  * request to the state machine
  */
 public CTPResponse ReleaseLock() {
   Release rel = new Release(clientID);
   return sMachine.Process(sMachine.SENDING, rel);
 }
Beispiel #6
0
 /**
  * Method request the file lock from the server returns 1 on success 0 on a failed response from
  * server -1 on a invalid request to the state machine
  */
 public CTPResponse ReqLock() {
   ReqLock rlock = new ReqLock(clientID);
   return sMachine.Process(sMachine.SENDING, rlock);
 }
Beispiel #7
0
 /**
  * Method Opens a file on the server returns 1 on success 0 on a failed response from server -1 on
  * a invalid request to the state machine
  */
 public CTPResponse Open() {
   Open openMsg = new Open(clientID, 3214);
   openMsg.dumpMsg();
   return sMachine.Process(sMachine.SENDING, openMsg);
 }
Beispiel #8
0
 /**
  * Method connects to the server returns 1 on success 0 on a failed response from server -1 on a
  * invalid request to the state machine
  */
 public CTPResponse Connect() {
   Connect connect = new Connect(VERSION);
   return sMachine.Process(sMachine.SENDING, connect);
 }
Beispiel #9
0
 /**
  * Method sends a Edit message to the server returns 1 on success 0 on a failed response from
  * server -1 on a invalid request to the state machine
  */
 public CTPResponse Edit(byte action, int cursorLoc, byte[] data) {
   Edit edit = new Edit(clientID, action, cursorLoc, data);
   return sMachine.Process(sMachine.SENDING, edit);
 }