The OnConnect event occurs after the client has established
its initial connection to the server, after the server has checked the
active client limits and the TLS handshake has been performed if required.
If the server has been suspended, or the limit on the maximum number of
client sessions has been exceeded, the server will terminate the client
session prior to this event handler being invoked.
If no event handler is implemented, the server will perform the default
action of accepting the connection and sending a standard greeting to the
client. If you want your application to send a custom greeting to the
client when it connects, call the SendResponse method, specifying a
result code of 220 and a message of your choice.
To reject a connection, call the SendResponse method to
send an error response to the client. Typically the result code value
would be 421 to indicate that the server will not accept the
connection. Next, call the DisconnectClient method to terminate
the client session.