vertx / io.vertx.rxjava.core.net / NetServer / listen

# listen

`open fun listen(): NetServer`

Start listening on the port and host as configured in the io.vertx.core.net.NetServerOptions used when creating the server.

The server may not be listening until some time after the call to listen has returned.

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

`open fun listen(listenHandler: Handler<AsyncResult<NetServer>>): NetServer`

Like `io.vertx.rxjava.core.net.NetServer#listen` but providing a handler that will be notified when the server is listening, or fails.

### Parameters

`listenHandler` - handler that will be notified when listening or failed

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

`open fun listen(port: Int, host: String): NetServer`

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

Port `0` can be specified meaning "choose an random port".

Host `0.0.0.0` can be specified meaning "listen on all available interfaces".

The server may not be listening until some time after the call to listen has returned.

### Parameters

`port` -

`host` -

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

`open fun listen(port: Int, host: String, listenHandler: Handler<AsyncResult<NetServer>>): NetServer`

Like `io.vertx.rxjava.core.net.NetServer#listen` but providing a handler that will be notified when the server is listening, or fails.

### Parameters

`port` - the port to listen on

`host` - the host to listen on

`listenHandler` - handler that will be notified when listening or failed

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

`open fun listen(port: Int): NetServer`

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

Port `0` can be specified meaning "choose an random port".

The server may not be listening until some time after the call to listen has returned.

### Parameters

`port` -

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

`open fun listen(port: Int, listenHandler: Handler<AsyncResult<NetServer>>): NetServer`

Like `io.vertx.rxjava.core.net.NetServer#listen` but providing a handler that will be notified when the server is listening, or fails.

### Parameters

`port` - the port to listen on

`listenHandler` - handler that will be notified when listening or failed

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

`open fun listen(localAddress: SocketAddress): NetServer`

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

The server may not be listening until some time after the call to listen has returned.

### Parameters

`localAddress` - the local address to listen on

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

`open fun listen(localAddress: SocketAddress, listenHandler: Handler<AsyncResult<NetServer>>): NetServer`

Like `io.vertx.rxjava.core.net.NetServer#listen` but providing a handler that will be notified when the server is listening, or fails.

### Parameters

`localAddress` - the local address to listen on

`listenHandler` - handler that will be notified when listening or failed

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