comparison test/channeltest/testSeMa.java @ 268:b69d22dbc6f1

*** empty log message ***
author kono
date Thu, 11 Sep 2008 15:00:16 +0900
parents e72e0eae1261
children d6a33e295d47
comparison
equal deleted inserted replaced
267:c513cf1ce9cc 268:b69d22dbc6f1
68 channel.configureBlocking(false); 68 channel.configureBlocking(false);
69 channel.register(selector, SelectionKey.OP_READ, null); 69 channel.register(selector, SelectionKey.OP_READ, null);
70 ns.writeLog("accepts a client.", 1); 70 ns.writeLog("accepts a client.", 1);
71 71
72 }else if(key.isReadable()){ 72 }else if(key.isReadable()){
73 REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack); 73 try {
74 String packet; 74 REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack);
75 packet = channel.read(); 75 String packet;
76 if (packet==null) continue; 76 packet = channel.read();
77 ns.writeLog("receives String==> `"+packet+"\'", 1); 77 if (packet==null) continue;
78 channel.write(this.getName()+": get `"+packet+"\'"); 78 ns.writeLog("receives String==> `"+packet+"\'", 1);
79 channel.write(this.getName()+": get `"+packet+"\'");
80 }catch (IOException e) {
81 ns.writeLog("channel "+ns+"closed.");
82 key.cancel();
83 }
79 } 84 }
80 } 85 }
81 } 86 }
82 catch (IOException e) { e.printStackTrace();} 87 catch (IOException e) { e.printStackTrace();}
83 } 88 }