Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/REPPacketReceive.java @ 13:00714676d05b
*** empty log message ***
author | pin |
---|---|
date | Fri, 02 Nov 2007 13:59:29 +0900 |
parents | e41994ce73c7 |
children | 47633cfb92d3 |
line wrap: on
line diff
--- a/rep/REPPacketReceive.java Fri Nov 02 13:37:45 2007 +0900 +++ b/rep/REPPacketReceive.java Fri Nov 02 13:59:29 2007 +0900 @@ -3,6 +3,8 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; +import java.util.LinkedList; +import java.util.StringTokenizer; public class REPPacketReceive { @@ -61,8 +63,23 @@ } String string = text; //System.out.println(string); + getSocket(string); REPCommand repcommand = new REPCommand(cmd, sid, eid, seqid, lineno, textsiz, string); System.out.println("received command: " + repcommand.toString()); return repcommand; } + + + private void getSocket(String string) { + StringTokenizer token = new StringTokenizer(string, "/:"); + LinkedList<String> tokenlist = new LinkedList<String>(); + while(token.hasMoreTokens()){ + tokenlist.add(token.nextToken()); + } + int port = Integer.parseInt(tokenlist.getLast()); + tokenlist.removeLast(); + String host = tokenlist.getLast(); + tokenlist.removeLast(); + System.out.println(host + ":" + port); + } }