List of usage examples for io.vertx.core.datagram DatagramSocket unlistenMulticastGroup
@Fluent DatagramSocket unlistenMulticastGroup(String multicastAddress, Handler<AsyncResult<Void>> handler);
From source file:examples.DatagramExamples.java
License:Open Source License
public void example6(Vertx vertx) { DatagramSocket socket = vertx.createDatagramSocket(new DatagramSocketOptions()); socket.listen(1234, "0.0.0.0", asyncResult -> { if (asyncResult.succeeded()) { socket.handler(packet -> { // Do something with the packet });/* w ww .j a v a 2 s. com*/ // join the multicast group socket.listenMulticastGroup("230.0.0.1", asyncResult2 -> { if (asyncResult2.succeeded()) { // will now receive packets for group // do some work socket.unlistenMulticastGroup("230.0.0.1", asyncResult3 -> { System.out.println("Unlisten succeeded? " + asyncResult3.succeeded()); }); } else { System.out.println("Listen failed" + asyncResult2.cause()); } }); } else { System.out.println("Listen failed" + asyncResult.cause()); } }); }