List of usage examples for io.vertx.core.datagram DatagramSocket send
Future<Void> send(String str, String enc, int port, String host);
From source file:examples.DatagramExamples.java
License:Open Source License
public void example2(Vertx vertx) { DatagramSocket socket = vertx.createDatagramSocket(new DatagramSocketOptions()); Buffer buffer = Buffer.buffer("content"); // Send a Buffer socket.send(buffer, 1234, "10.0.0.1", asyncResult -> { System.out.println("Send succeeded? " + asyncResult.succeeded()); });/*from w w w. j a va 2 s .c o m*/ // Send a String socket.send("A string used as content", 1234, "10.0.0.1", asyncResult -> { System.out.println("Send succeeded? " + asyncResult.succeeded()); }); }
From source file:examples.DatagramExamples.java
License:Open Source License
public void example4(Vertx vertx) { DatagramSocket socket = vertx.createDatagramSocket(new DatagramSocketOptions()); Buffer buffer = Buffer.buffer("content"); // Send a Buffer to a multicast address socket.send(buffer, 1234, "230.0.0.1", asyncResult -> { System.out.println("Send succeeded? " + asyncResult.succeeded()); });/*from w ww .j a v a 2 s . c o m*/ }