public interface NetServer extends ServerSSLSupport<NetServer>, ServerTCPSupport<NetServer>
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.
Instances of this class are thread-safe.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the server.
|
void |
close(Handler<AsyncResult<java.lang.Void>> doneHandler)
Close the server.
|
NetServer |
connectHandler(Handler<NetSocket> connectHandler)
Supply a connect handler for this server.
|
java.lang.String |
host()
The host
|
NetServer |
listen(int port)
Tell the server to start listening on all available interfaces and port
port . |
NetServer |
listen(int port,
Handler<AsyncResult<NetServer>> listenHandler)
Instruct the server to listen for incoming connections on the specified
port and all available interfaces. |
NetServer |
listen(int port,
java.lang.String host)
Tell the server to start listening on port
port and hostname or ip address given by host . |
NetServer |
listen(int port,
java.lang.String host,
Handler<AsyncResult<NetServer>> listenHandler)
Instruct the server to listen for incoming connections on the specified
port and host . |
int |
port()
The actual port the server is listening on.
|
isClientAuthRequired, setClientAuthRequired
getKeyStorePassword, getKeyStorePath, getTrustStorePassword, getTrustStorePath, isSSL, setKeyStorePassword, setKeyStorePath, setSSL, setSSLContext, setTrustStorePassword, setTrustStorePath
getAcceptBacklog, setAcceptBacklog
getSoLinger, isTCPKeepAlive, isTCPNoDelay, isUsePooledBuffers, setSoLinger, setTCPKeepAlive, setTCPNoDelay, setUsePooledBuffers
getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setTrafficClass
NetServer connectHandler(Handler<NetSocket> connectHandler)
NetSocket
and passes it to the
connect handler.NetServer listen(int port)
port
. Be aware this is an
async operation and the server may not bound on return of the method.NetServer listen(int port, Handler<AsyncResult<NetServer>> listenHandler)
port
and all available interfaces.NetServer listen(int port, java.lang.String host)
port
and hostname or ip address given by host
. Be aware this is an
async operation and the server may not bound on return of the method.NetServer listen(int port, java.lang.String host, Handler<AsyncResult<NetServer>> listenHandler)
port
and host
. host
can
be a host name or an IP address.void close()
void close(Handler<AsyncResult<java.lang.Void>> doneHandler)
done
will be called
when the close is complete.int port()
java.lang.String host()