示例#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;
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }