Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. Selector selector = Selector.open()
  2. DatagramChannel channel = DatagramChannel.open(StandardProtocolFamily.INET);
  3. channel.configureBlocking(false);
  4. channel.register(selector, SelectionKey.OP_READ);
  5. while (true) {
  6. if (selector.select(1000) > 0) { //timeout 1 second
  7. // process received data
  8. }
  9. }
  10.  
  11. channel.join(group, interface);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement