Beispiel #1
0
        private void Recieve_Completed(object sender, SocketAsyncEventArgs e)
        {
            Socket   _client   = (Socket)sender;
            Telegram _telegram = (Telegram)e.UserToken;

            _telegram.SetLength(e.Buffer);
            _telegram.InitData();
            if (_client.Connected)
            {
                _client.Receive(_telegram.Data, _telegram.DataLength, SocketFlags.None);
                SendDisplay(_telegram.GetData(), ChatType.Receive);
            }
            else
            {
                SendDisplay("Connection Failed.", ChatType.System);
            }
            if (_client.Connected)
            {
                _client.ReceiveAsync(e);
            }
            else
            {
                m_Client.Remove(_client);
            }
        }
Beispiel #2
0
        private void Send_Completed(object sender, SocketAsyncEventArgs e)
        {
            Socket   _client   = (Socket)sender;
            Telegram _telegram = (Telegram)e.UserToken;

            _client.Send(_telegram.Data);
            SendDisplay(_telegram.GetData(), ChatType.Send);
        }