public interface NetServer extends Measured
Represents a TCP or SSL server<p> If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread (i.e. when running embedded) then and event loop will be assigned to the instance and used when any of its handlers are called.<p> Instances of this class are thread-safe.<p>
Modifier and Type | Method and Description |
---|---|
int |
actualPort()
The actual port the server is listening on.
|
void |
close()
Close the server.
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the server.
|
Handler<NetSocket> |
connectHandler() |
NetServer |
connectHandler(Handler<NetSocket> handler)
Supply a connect handler for this server.
|
NetSocketStream |
connectStream()
Return the connect stream for this server.
|
NetServer |
listen() |
NetServer |
listen(Handler<AsyncResult<NetServer>> listenHandler)
Instruct the server to listen for incoming connections on the specified
port and all available interfaces. |
metricBaseName, metrics
NetSocketStream connectStream()
Return the connect stream for this server. The server can only have at most one handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of NetSocket
and passes it to the
connect stream ReadStream.handler(io.vertx.core.Handler)
.
NetServer connectHandler(Handler<NetSocket> handler)
Supply a connect handler for this server. The server can only have at most one connect handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of NetSocket
and passes it to the
connect handler.
NetServer listen()
NetServer listen(Handler<AsyncResult<NetServer>> listenHandler)
Instruct the server to listen for incoming connections on the specified port
and all available interfaces.
void close()
Close the server. This will close any currently open connections.
void close(Handler<AsyncResult<Void>> completionHandler)
Close the server. This will close any currently open connections. The event handler done
will be called
when the close is complete.
int actualPort()
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
Copyright © 2014. All Rights Reserved.