Mercurial > hg > RemoteEditor > REPSessionManager
comparison test/ServerSample.java @ 168:4ed6393ec68e
*** empty log message ***
author | kono |
---|---|
date | Thu, 28 Aug 2008 18:54:01 +0900 |
parents | 63a473db5cbf |
children | be219ba8b39c |
comparison
equal
deleted
inserted
replaced
167:3dc194f5e28f | 168:4ed6393ec68e |
---|---|
12 { | 12 { |
13 public static void main(String[] argv) | 13 public static void main(String[] argv) |
14 throws Exception | 14 throws Exception |
15 { | 15 { |
16 // セレクタの用意 | 16 // セレクタの用意 |
17 REPSelector selector = REPSelector.open(); | 17 REPSelector selector = REPSelector.create(); |
18 | 18 |
19 // サーバソケットチャンネルを作成。5100番ポートを受付ポートに指定 | 19 // サーバソケットチャンネルを作成。5100番ポートを受付ポートに指定 |
20 // (非ブロックモードに設定:重要) | 20 // (非ブロックモードに設定:重要) |
21 REPServerSocketChannel<REPCommand> serverSocketChannel = REPServerSocketChannel.open(); | 21 REPServerSocketChannel<REPCommand> serverSocketChannel = REPServerSocketChannel.<REPCommand>open(); |
22 serverSocketChannel.configureBlocking(false); | 22 serverSocketChannel.configureBlocking(false); |
23 serverSocketChannel.socket().bind(new InetSocketAddress(5100)); | 23 serverSocketChannel.socket().bind(new InetSocketAddress(5100)); |
24 | 24 |
25 // セレクタにサーバソケットチャンネルを登録。サーバへの受付を監視 | 25 // セレクタにサーバソケットチャンネルを登録。サーバへの受付を監視 |
26 serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT); | 26 serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT); |