NetAcceptor
Generic interface defining a server that spawns NetConnection s. It has 2 direct methods:
- Listen: starts the server in listen mode on the specified local address
- Close: closes the server.
To interact with the server, the application needs to provide several PERMANENT callbacks, for notification receiving:
- Filter callback: called every time a new client wishes to connect. It acts like a filter to cut down early the undesired clients. If this filter is missing, then all incoming clients are accepted.
In response to this notification, the application may return:
- false: the client is rejected.
- true: the acceptor continues with handshake exchange.
If the hanshake falls, the client is rejected, no further notifications are sent back to application.
If the hanshake succeeds, the acceptor creates a new connection object (it wraps the network socket and communication methods) and forwards it to application through Accept callback.
- Accept callback: the application receives a fully established connection, ready for use. The application is responsible with closing and deleting the connection whenever it desires.
NetAcceptor is extended by: TcpAcceptor, SslAcceptor.
See NetFactory.
