Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Selector selector = Selector.open()
- DatagramChannel channel = DatagramChannel.open(StandardProtocolFamily.INET);
- channel.configureBlocking(false);
- channel.register(selector, SelectionKey.OP_READ);
- while (true) {
- if (selector.select(1000) > 0) { //timeout 1 second
- // process received data
- }
- }
- channel.join(group, interface);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement