Ejemplo n.º 1
0
 public long openUdpSocket(InetSocketAddress address) throws IOException {
   // TODO, don't throw an exception out of here.
   DatagramChannel dg = DatagramChannel.open();
   dg.configureBlocking(false);
   dg.socket().bind(address);
   long b = createBinding();
   EventableChannel ec = new EventableDatagramChannel(dg, b, mySelector);
   dg.register(mySelector, SelectionKey.OP_READ, ec);
   Connections.put(b, ec);
   return b;
 }