示例#1
0
        private void OnAcceptSocket(IAsyncResult asyncResult)
        {
            try
            {
                _tcpConnection = null;

                try
                {
                    _tcpConnection = new TcpConnection(_tcpListener.EndAcceptTcpClient(asyncResult));
                }
                catch (ObjectDisposedException)
                {
                    return;
                }

                if (_connectionSecurity == eConnectionSecurity.eCSTLS)
                {
                    _tcpConnection.HandshakeAsServer(_localCertificate);
                }

                _numberOfConnectedClients++;

                HandleClient();
            }
            finally
            {
                DisposeSocket();

                _clientCompleted.Set();
            }
        }
示例#2
0
        private void OnAcceptSocket(IAsyncResult asyncResult)
        {
            try
             {
            _tcpConnection = null;

            try
            {
               _tcpConnection = new TcpConnection(_tcpListener.EndAcceptTcpClient(asyncResult));
            }
            catch (ObjectDisposedException)
            {
               return;
            }

            if (_connectionSecurity == eConnectionSecurity.eCSTLS)
            {
               _tcpConnection.HandshakeAsServer(_localCertificate);
            }

            _numberOfConnectedClients++;

            HandleClient();
             }
             finally
             {
            DisposeSocket();

            _clientCompleted.Set();
             }
        }