vertx / io.vertx.core.net / NetClient / connect

# connect

`abstract fun connect(port: Int, host: String, connectHandler: Handler<AsyncResult<NetSocket>>): NetClient`

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

Return
a reference to this, so the API can be used fluently

`abstract fun connect(port: Int, host: String, serverName: String, connectHandler: Handler<AsyncResult<NetSocket>>): NetClient`

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

Return
a reference to this, so the API can be used fluently

`abstract fun connect(remoteAddress: SocketAddress, connectHandler: Handler<AsyncResult<NetSocket>>): NetClient`

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

Return
a reference to this, so the API can be used fluently

`abstract fun connect(remoteAddress: SocketAddress, serverName: String, connectHandler: Handler<AsyncResult<NetSocket>>): NetClient`

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

Return
a reference to this, so the API can be used fluently