Example #1
0
        private void StartReceive(TCPUserToken token)
        {
            bool asyncResult;

            try
            {
                asyncResult = token.ReceiveAsync(token.receiveEventArgs);
            }
            catch (ObjectDisposedException)
            {
                return;
            }
            catch (SocketException e)
            {
                token.MarkToDisconnect($"Receive error:{e}, remote endpoint: {token.remoteEndPoint}", e.SocketErrorCode);
                return;
            }
            if (!asyncResult)
            {
                this.ProcessReceive(token.receiveEventArgs);
            }
        }