Interface NetServer

All Superinterfaces:
NetworkApplication, Runnable
All Known Implementing Classes:
DTLSServer, PlainTCPServer, PlainUDPServer, TCPServer, TLSServer, UDPServer

public interface NetServer extends NetworkApplication
Represents an application accepting SocketConnections from clients.

To accept connections, setConnectionCallback(Consumer) must be called.

  • Method Details

    • setConnectionCallback

      void setConnectionCallback(Consumer<SocketConnection> handler)
      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