Beispiel #1
0
        private void ReceiveProcess(SocketAsyncEventArgs socketArgs)
        {
            if (!IsWork)
            {
                return;
            }
            try
            {
                if (socketArgs.SocketError == SocketError.SocketError ||
                    socketArgs.BytesTransferred == 0)
                {
                    this.Close();
                    return;
                }
                ConnectionStatus.ReceivedBytes += socketArgs.BytesTransferred;
                ReceiveStream.WriteBytes(EncDec.Decode(
                                             socketArgs.Buffer,
                                             socketArgs.BytesTransferred));
            }
            catch
            {
                Close();
            }

            Host.HandleReceivedStream(ReceiveStream);
            StartReceive();
        }