equal
deleted
inserted
replaced
35 |
35 |
36 public static void main(String[] argv) throws Exception { |
36 public static void main(String[] argv) throws Exception { |
37 ByteServer server = new ByteServer(0); // server: accept connection and do nothing |
37 ByteServer server = new ByteServer(0); // server: accept connection and do nothing |
38 server.start(); |
38 server.start(); |
39 InetSocketAddress isa = new InetSocketAddress( |
39 InetSocketAddress isa = new InetSocketAddress( |
40 InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT); |
40 InetAddress.getByName(ByteServer.LOCALHOST), server.port()); |
41 Selector sel = Selector.open(); |
41 Selector sel = Selector.open(); |
42 SocketChannel sc = SocketChannel.open(); |
42 SocketChannel sc = SocketChannel.open(); |
43 sc.connect(isa); |
43 sc.connect(isa); |
44 sc.configureBlocking(false); |
44 sc.configureBlocking(false); |
45 sc.register(sel, SelectionKey.OP_READ); |
45 sc.register(sel, SelectionKey.OP_READ); |