Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }