io.vertx.core.net

## Interface NetClient

- All Superinterfaces:
    Measured

      public interface NetClient
      extends Measured

  A TCP client.

  Multiple connections to different servers can be made using the same instance.

  This client supports a configurable number of connection attempts and a configurable delay between attempts.

  Author:
    Tim Fox

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the client.
    `NetClient` | `connect(int port, String host, Handler<AsyncResult<NetSocket>> connectHandler)` Open a connection to a server at the specific `port` and `host`.
    `NetClient` | `connect(int port, String host, String serverName, Handler<AsyncResult<NetSocket>> connectHandler)` Open a connection to a server at the specific `port` and `host`.
    `NetClient` | `connect(SocketAddress remoteAddress, Handler<AsyncResult<NetSocket>> connectHandler)` Open a connection to a server at the specific `remoteAddress`.
    `NetClient` | `connect(SocketAddress remoteAddress, String serverName, Handler<AsyncResult<NetSocket>> connectHandler)` Open a connection to a server at the specific `remoteAddress`.

    - ### Methods inherited from interface io.vertx.core.metrics.Measured

      `isMetricsEnabled`

- - ### Method Detail

    - #### connect

          NetClient connect(int port,
                            String host,
                            Handler<AsyncResult<NetSocket>> connectHandler)

      Open a connection to a server at the specific `port` and `host`.

      `host` can be a valid host name or IP address. The connect is done asynchronously and on success, a `NetSocket` instance is supplied via the `connectHandler` instance

      Parameters:
        `port` - the port
        `host` - the host
      Returns:
        a reference to this, so the API can be used fluently

    - #### connect

          NetClient connect(int port,
                            String host,
                            String serverName,
                            Handler<AsyncResult<NetSocket>> connectHandler)

      Open a connection to a server at the specific `port` and `host`.

      `host` can be a valid host name or IP address. The connect is done asynchronously and on success, a `NetSocket` instance is supplied via the `connectHandler` instance

      Parameters:
        `port` - the port
        `host` - the host
        `serverName` - the SNI server name
      Returns:
        a reference to this, so the API can be used fluently

    - #### connect

          NetClient connect(SocketAddress remoteAddress,
                            Handler<AsyncResult<NetSocket>> connectHandler)

      Open a connection to a server at the specific `remoteAddress`.

      The connect is done asynchronously and on success, a `NetSocket` instance is supplied via the `connectHandler` instance

      Parameters:
        `remoteAddress` - the remote address
      Returns:
        a reference to this, so the API can be used fluently

    - #### connect

          NetClient connect(SocketAddress remoteAddress,
                            String serverName,
                            Handler<AsyncResult<NetSocket>> connectHandler)

      Open a connection to a server at the specific `remoteAddress`.

      The connect is done asynchronously and on success, a `NetSocket` instance is supplied via the `connectHandler` instance

      Parameters:
        `remoteAddress` - the remote address
        `serverName` - the SNI server name
      Returns:
        a reference to this, so the API can be used fluently

    - #### close

          void close()

      Close the client.

      Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.

Copyright © 2018 Eclipse. All rights reserved.