/** 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; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }