Mercurial > hg > RemoteEditor > REPSessionManager
changeset 10:09316c8a674a
*** empty log message ***
author | pin |
---|---|
date | Fri, 02 Nov 2007 13:21:12 +0900 |
parents | 2d4c2c19d2d0 |
children | 167694db4796 |
files | rep/SessionManager.java |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/SessionManager.java Tue Oct 30 15:52:02 2007 +0900 +++ b/rep/SessionManager.java Fri Nov 02 13:21:12 2007 +0900 @@ -1,6 +1,7 @@ package rep; import java.io.IOException; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; @@ -118,10 +119,12 @@ int eid = sessionlist.getNumberOfEditor(); //eidを取得 sessionmanagerGUI.setComboEditor(eid, channel); //ComboBoxにEditorを追加 repCmd.setEID(eid); //eidを決定して、 - repCmd.setCMD(repCmd.cmd + 1); //ACKを返す + //repCmd.setCMD(repCmd.cmd + 1); //ACKを返す + repCmd.setCMD(REP.SMCMD_JOIN_ACK); repCmd.string = sessionlist.getSessionList(); //Session一覧を REPPacketSend repSend = new REPPacketSend(channel); //Editor側へ送信 repSend.send(repCmd); + join_ack(channel, repCmd); break; case REP.SMCMD_JOIN_ACK: @@ -154,6 +157,7 @@ smList.add(channel); //SessionManagerのリストへ追加 repCmd.setCMD(repCmd.cmd + 1); REPPacketSend repSend4 = new REPPacketSend(channel); + sm_join_ack(channel); repSend4.send(repCmd); //ACK break; case REP.SMCMD_SM_JOIN_ACK: @@ -179,6 +183,16 @@ } } + private void sm_join_ack(SocketChannel channel) { + InetAddress address = channel.socket().getInetAddress(); + System.out.println(address); + } + + private void join_ack(SocketChannel channel, REPCommand repCmd) { + String dis_host = channel.socket().getRemoteSocketAddress().toString(); + System.out.println(dis_host); + } + public static void main(String[] args) throws InterruptedException, IOException { int port = 8766;