private DatagramChannel openUdpChannel ( InetAddress localAddress , int port , Selector selector ) throws IOException { DatagramChannel channel = DatagramChannel . open ( ) ; channel . configureBlocking ( false ) ; // Register selector for reading operations channel . register ( selector , SelectionKey . OP_READ | SelectionKey . OP_WRITE ) ; channel . bind ( new InetSocketAddress ( localAddress , port ) ) ; return channel ; }
Opens a datagram channel and binds it to an address .