NetServer

Represents a TCP server

package

Default

Methods

__construct

__construct() 

The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port

actualPort() : integer

Response

integer

the actual port the server is listening on.

Close the server. This will close any currently open connections. The close may not complete until after this method has returned.

close( $arg0 = null) : void

close()

Like @see \io\vertx\jphp\core\net\NetServer::close but supplying a handler that will be notified when close is complete.

param $completionHandler [callable] the handler close($completionHandler)

Arguments

$arg0

callable

Supply a connect handler for this server. The server can only have at most one connect handler at any one time.

connectHandler( $arg0) : \io\vertx\jphp\core\net\NetServer

As the server accepts TCP or SSL connections it creates an instance of @see \io\vertx\jphp\core\net\NetSocket and passes it to the connect handler.

Arguments

$arg0

callable

Response

\io\vertx\jphp\core\net\NetServer

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

Return the connect stream for this server. The server can only have at most one handler at any one time.

connectStream() : \io\vertx\jphp\core\net\ReadStream<NetSocket>

As the server accepts TCP or SSL connections it creates an instance of @see \io\vertx\jphp\core\net\NetSocket and passes it to the connect stream .

Response

\io\vertx\jphp\core\net\ReadStream

the connect stream

Whether the metrics are enabled for this measured object

isMetricsEnabled() : boolean

Response

boolean

{@code true} if metrics are enabled

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

listen( $arg0 = null,  $arg1 = null,  $arg2 = null) : $this

The server may not be listening until some time after the call to listen has returned. listen() Like @see \io\vertx\jphp\core\net\NetServer::listen but providing a handler that will be notified when the server is listening, or fails. param $listenHandler [callable] handler that will be notified when listening or failed listen($listenHandler) Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the

see \io\vertx\jphp\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. param $port [integer] listen($port) Start listening on the specified local address, ignoring port and host configured in the @see \io\vertx\jphp\core\net\NetServerOptions used when creating the server.

The server may not be listening until some time after the call to listen has returned. param $localAddress [SocketAddress] the local address to listen on listen($localAddress) Start listening on the specified port and host, ignoring port and host configured in the @see \io\vertx\jphp\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. param $port [integer] param $host [string] listen($port, $host) Like @see \io\vertx\jphp\core\net\NetServer::listen but providing a handler that will be notified when the server is listening, or fails. param $port [integer] the port to listen on param $listenHandler [callable] handler that will be notified when listening or failed listen($port, $listenHandler) Like @see \io\vertx\jphp\core\net\NetServer::listen but providing a handler that will be notified when the server is listening, or fails. param $localAddress [SocketAddress] the local address to listen on param $listenHandler [callable] handler that will be notified when listening or failed listen($localAddress, $listenHandler) Like @see \io\vertx\jphp\core\net\NetServer::listen but providing a handler that will be notified when the server is listening, or fails. param $port [integer] the port to listen on param $host [string] the host to listen on param $listenHandler [callable] handler that will be notified when listening or failed listen($port, $host, $listenHandler)

Arguments

$arg0

callable | integer | SocketAddress

$arg1

callable | string

$arg2

callable

Response

$this

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