Mercurial > hg > RemoteEditor > REPSessionManager
changeset 11:167694db4796
*** empty log message ***
author | pin |
---|---|
date | Fri, 02 Nov 2007 13:21:12 +0900 |
parents | 09316c8a674a |
children | aee937370052 |
files | rep/EditorChannel.java rep/SessionManager.java |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/EditorChannel.java Fri Nov 02 13:21:12 2007 +0900 +++ b/rep/EditorChannel.java Fri Nov 02 13:21:12 2007 +0900 @@ -5,16 +5,17 @@ public abstract class EditorChannel extends SocketChannel { + private REPPacketSend repsend; + private REPPacketReceive reprec; + protected EditorChannel(SelectorProvider provider) { super(provider); } - - private REPPacketSend repsend; - private REPPacketReceive reprec; public void putPacket(REPCommand comm){ repsend.send(comm); } + public REPCommand getPacket(){ REPCommand command = reprec.unpack(); return command; @@ -24,5 +25,10 @@ repsend = new REPPacketSend(channel); reprec = new REPPacketReceive(channel); } + + public void setIO() { + repsend = new REPPacketSend(this); + reprec = new REPPacketReceive(this); + } }
--- a/rep/SessionManager.java Fri Nov 02 13:21:12 2007 +0900 +++ b/rep/SessionManager.java Fri Nov 02 13:21:12 2007 +0900 @@ -3,6 +3,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.SocketAddress; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; @@ -184,7 +185,7 @@ } private void sm_join_ack(SocketChannel channel) { - InetAddress address = channel.socket().getInetAddress(); + SocketAddress address = channel.socket().getRemoteSocketAddress(); System.out.println(address); }