Example usage for io.vertx.core.net NetServer listen

List of usage examples for io.vertx.core.net NetServer listen

Introduction

In this page you can find the example usage for io.vertx.core.net NetServer listen.

Prototype

Future<NetServer> listen(SocketAddress localAddress);

Source Link

Document

Start listening on the specified local address, ignoring port and host configured in the io.vertx.core.net.NetServerOptions used when creating the server.

Usage

From source file:examples.CoreExamples.java

License:Open Source License

public void exampleFutureAll1(HttpServer httpServer, NetServer netServer) {
    Future<HttpServer> httpServerFuture = Future.future();
    httpServer.listen(httpServerFuture.completer());

    Future<NetServer> netServerFuture = Future.future();
    netServer.listen(netServerFuture.completer());

    CompositeFuture.all(httpServerFuture, netServerFuture).setHandler(ar -> {
        if (ar.succeeded()) {
            // All servers started
        } else {/*from  w w w.  j a  va  2s. c o  m*/
            // At least one server failed
        }
    });
}