changeset 20:83088d943612

*** empty log message ***
author pin
date Tue, 06 Nov 2007 15:26:37 +0900
parents b2ebdec2cb50
children 2d4bab638a71
files rep/REPPacketReceive.java
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rep/REPPacketReceive.java	Fri Nov 02 16:10:53 2007 +0900
+++ b/rep/REPPacketReceive.java	Tue Nov 06 15:26:37 2007 +0900
@@ -67,9 +67,9 @@
 		//System.out.println(string);
 		//getSocket(string);
 		REPCommand repcommand = new REPCommand(cmd, sid, eid, seqid, lineno, textsiz, string);
-		//getSocket(repcommand);
 		System.out.println("received command: " + repcommand.toString());
 		getSocket(repcommand);
+		System.out.println("received command: " + repcommand.toString());
 		return repcommand;
 	}
 
@@ -78,13 +78,18 @@
 		if(command.cmd != REP.SMCMD_JOIN){
 		String string = command.string;
 		StringTokenizer st2 = new StringTokenizer(string, ":");
-		String host = st2.nextToken();
-		String portstring = st2.nextToken();
-		//int port = Integer.parseInt(portstring);
-		int socketInfoLength = host.length() + portstring.length() + 2;
+		LinkedList<String> list = new LinkedList<String>();
+		while (st2.hasMoreTokens()){
+			list.add(st2.nextToken());
+		}
+		String port = list.getLast();
+		list.removeLast();
+		String host = list.getLast();
+		int socketInfoLength = host.length() + port.length() + 2;
+		System.out.println(host.length() + ":" + port.length() + ":" + socketInfoLength);
 		command.setString(string.substring(0, string.length() - socketInfoLength));
 		command.setHost(host);
-		command.setPort(portstring);
+		command.setPort(port);
 		}
 	}
 }