Example #1
0
        protected void AcceptHandler(IAsyncResult ar)
        {
            // Signal the main thread to continue.
            _connAccepted.Set();

            // Get the socket that handles the client request.
            Socket clientSock = this._socket.EndAccept(ar);

            _logger.Debug($"Client connected from {clientSock.RemoteEndPoint}");

            // Create client
            InputConnection client = new InputConnection(clientSock);

            // Emit events and run default class handler
            this.OnConnection(client);
            NewConnection?.Invoke(client);
        }
Example #2
0
 protected abstract void OnConnection(InputConnection sock);