Mercurial > hg > RemoteEditor > Eclipse
changeset 29:d2f8d056aae3
*** empty log message ***
author | pin |
---|---|
date | Tue, 19 Dec 2006 12:48:24 +0900 |
parents | d01cc686b54f |
children | 5723cfd85c95 |
files | bin/remoteeditor/network/REP.class src/remoteeditor/network/REP.java |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/remoteeditor/network/REP.java Mon Dec 18 19:47:03 2006 +0900 +++ b/src/remoteeditor/network/REP.java Tue Dec 19 12:48:24 2006 +0900 @@ -195,7 +195,7 @@ String text = ""; cmd = header.getInt(); sid = header.getInt(); - eid = header.getInt(); + int eid2 = header.getInt(); seqid = header.getInt(); lineno = header.getInt(); textsiz = header.getInt()/2; @@ -217,7 +217,7 @@ } string = text; try { - othersCmdList.add(new Rep_Cmd(cmd, sid, eid, seqid, lineno, textsiz, text)); + if(eid2 != eid) othersCmdList.add(new Rep_Cmd(cmd, sid, eid, seqid, lineno, textsiz, text)); } catch (Exception e) { e.printStackTrace(); } @@ -233,7 +233,11 @@ while(sc.isConnected()){ unpack(); System.out.println("read packet:" + cmd +", "+ sid +", "+ eid +", "+ seqid +", "+ lineno +", "+ textsiz +", "+ string); - socketListener.packetReceived(new RSocketEvent(cmd, sid, eid, seqid, lineno, textsiz, string)); // + for(Rep_Cmd othersCmd:othersCmdList){ + socketListener.packetReceived(new RSocketEvent(othersCmd.cmd, othersCmd.sid, othersCmd.eid, othersCmd.seq, othersCmd.lineno, othersCmd.string.length(), othersCmd.string)); + othersCmdList.remove(othersCmd); + } + //socketListener.packetReceived(new RSocketEvent(cmd, sid, eid, seqid, lineno, textsiz, string)); // } } @@ -259,14 +263,18 @@ } } - public void sendCmd(int cmd2, int line, int length, String lineText) { + public synchronized void sendCmd(int cmd2, int line, int length, String lineText) { //cmd = REP_INSERT_CMD; - rWrite(pack(cmd2, sid, eid, seqid, line, lineText)); + //rWrite(pack(cmd2, sid, eid, seqid, line, lineText)); try { myCmdList.add(new Rep_Cmd(cmd2, sid, eid, seqid, line, length, lineText)); System.out.println("myCmdList : " + myCmdList.toString()); System.out.println("othersCmdList : " + othersCmdList.toString()); new Translate(myCmdList, othersCmdList); + for(Rep_Cmd userCmd:myCmdList){ + rWrite(pack(userCmd.cmd, userCmd.sid, userCmd.eid, userCmd.seq, userCmd.lineno, userCmd.string)); + myCmdList.remove(userCmd); + } } catch (Exception e) { e.printStackTrace(); }