Package org.omegazero.net.server
Interface NetServer
- All Superinterfaces:
NetworkApplication
,Runnable
- All Known Implementing Classes:
DTLSServer
,PlainTCPServer
,PlainUDPServer
,TCPServer
,TLSServer
,UDPServer
Represents an application accepting
SocketConnection
s from clients.
To accept connections, setConnectionCallback(Consumer)
must be called.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setConnectionCallback
(Consumer<SocketConnection> handler) Sets the callback for a new incoming connection.Methods inherited from interface org.omegazero.net.common.NetworkApplication
close, init, run, start
-
Method Details
-
setConnectionCallback
Sets the callback for a new incoming connection.The first parameter of this callback is an
SocketConnection
instance representing the new connection from the client.This method must be called before
NetworkApplication.start()
, otherwise, behavior is undefined.- Parameters:
handler
- The connection callback
-