public class NetServerImpl extends TCPServerBase implements Closeable, MetricsProvider, NetServer
creatingContext, options, sslHelper, vertx| Constructor and Description |
|---|
NetServerImpl(VertxInternal vertx,
NetServerOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept() |
Future<Void> |
close()
Close the server.
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Like
NetServer.close() but supplying a handler that will be notified when close is complete. |
void |
close(Promise<Void> completion)
Close this resource, the
completion promise must be notified when the operation has completed. |
Handler<NetSocket> |
connectHandler() |
NetServer |
connectHandler(Handler<NetSocket> handler)
Supply a connect handler for this server.
|
ReadStream<NetSocket> |
connectStream()
Return the connect stream for this server.
|
protected TCPMetrics<?> |
createMetrics(SocketAddress localAddress) |
NetServer |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler called for socket errors happening before the connection
is passed to the
NetServer.connectHandler(io.vertx.core.Handler<io.vertx.core.net.NetSocket>), e.g during the TLS handshake. |
protected void |
initChannel(io.netty.channel.ChannelPipeline pipeline) |
boolean |
isClosed() |
Future<NetServer> |
listen()
Start listening on the port and host as configured in the
NetServerOptions used when
creating the server. |
NetServer |
listen(Handler<AsyncResult<NetServer>> listenHandler)
Like
NetServer.listen() but providing a handler that will be notified when the server is listening, or fails. |
Future<NetServer> |
listen(int port)
Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the
NetServerOptions used when creating the server. |
NetServer |
listen(int port,
Handler<AsyncResult<NetServer>> listenHandler)
Like
NetServer.listen(int) but providing a handler that will be notified when the server is listening, or fails. |
Future<NetServer> |
listen(int port,
String host)
Start listening on the specified port and host, ignoring port and host configured in the
NetServerOptions used when
creating the server. |
NetServer |
listen(int port,
String host,
Handler<AsyncResult<NetServer>> listenHandler)
Like
NetServer.listen(int, String) but providing a handler that will be notified when the server is listening, or fails. |
Future<NetServer> |
listen(SocketAddress localAddress)
Start listening on the specified local address, ignoring port and host configured in the
NetServerOptions used when
creating the server. |
NetServer |
listen(SocketAddress localAddress,
Handler<AsyncResult<NetServer>> listenHandler)
Like
NetServer.listen(SocketAddress) but providing a handler that will be notified when the server is listening, or fails. |
actualPort, closeAll, finalize, getMetrics, isListening, isMetricsEnabled, listenclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetricsactualPortisMetricsEnabledpublic NetServerImpl(VertxInternal vertx, NetServerOptions options)
protected boolean accept()
public Handler<NetSocket> connectHandler()
connectHandler in interface NetServerpublic NetServer connectHandler(Handler<NetSocket> handler)
NetServerNetSocket and passes it to the
connect handler.connectHandler in interface NetServerpublic NetServer exceptionHandler(Handler<Throwable> handler)
NetServerNetServer.connectHandler(io.vertx.core.Handler<io.vertx.core.net.NetSocket>), e.g during the TLS handshake.exceptionHandler in interface NetServerhandler - the handler to setprotected void initChannel(io.netty.channel.ChannelPipeline pipeline)
protected TCPMetrics<?> createMetrics(SocketAddress localAddress)
createMetrics in class TCPServerBasepublic Future<Void> close()
NetServerclose in interface NetServerclose in class TCPServerBasepublic Future<NetServer> listen(int port, String host)
NetServerNetServerOptions 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.
public NetServer listen(int port, String host, Handler<AsyncResult<NetServer>> listenHandler)
NetServerNetServer.listen(int, String) but providing a handler that will be notified when the server is listening, or fails.public Future<NetServer> listen(int port)
NetServerNetServerOptions 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.
public NetServer listen(int port, Handler<AsyncResult<NetServer>> listenHandler)
NetServerNetServer.listen(int) but providing a handler that will be notified when the server is listening, or fails.public Future<NetServer> listen(SocketAddress localAddress)
NetServerNetServerOptions used when
creating the server.
The server may not be listening until some time after the call to listen has returned.
public NetServer listen(SocketAddress localAddress, Handler<AsyncResult<NetServer>> listenHandler)
NetServerNetServer.listen(SocketAddress) but providing a handler that will be notified when the server is listening, or fails.public Future<NetServer> listen()
NetServerNetServerOptions used when
creating the server.
The server may not be listening until some time after the call to listen has returned.
public NetServer listen(Handler<AsyncResult<NetServer>> listenHandler)
NetServerNetServer.listen() but providing a handler that will be notified when the server is listening, or fails.public ReadStream<NetSocket> connectStream()
NetServerNetSocket and passes it to the
connect stream ReadStream.handler(io.vertx.core.Handler).connectStream in interface NetServerpublic void close(Handler<AsyncResult<Void>> completionHandler)
NetServerNetServer.close() but supplying a handler that will be notified when close is complete.public void close(Promise<Void> completion)
Closeablecompletion promise must be notified when the operation has completed.close in interface Closeableclose in class TCPServerBasecompletion - the promise to signal when close has completedpublic boolean isClosed()
Copyright © 2021. All rights reserved.