Exemplo n.º 1
0
        private void DataReceived(uint connectionId, Connection connection, uint packId, IList <ArraySegment <Byte> > buffer)
        {
            var idSet = connection.receiveIDSet;

            if (idSet.IsReceived(packId))
            {
            }
            else
            {
                Debug.WriteLine("Received Message: " + BcpUtil.ArraySegmentListToString(buffer));
                EventHandler <ReceivedEventArgs> receivedEventHandler = Received;
                if (receivedEventHandler != null)
                {
                    try
                    {
                        receivedEventHandler(this, new ReceivedEventArgs(buffer));
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine("Received event occur exception: " + e);
                    }
                }
                connection.receiveIDSet.Add(packId);
                CheckConnectionFinish(connectionId, connection);
            }
        }
Exemplo n.º 2
0
 public void Send(IList <ArraySegment <Byte> > buffer)
 {
     Debug.WriteLine("Send Message: " + BcpUtil.ArraySegmentListToString(buffer));
     lock (sessionLock)
     {
         Enqueue(new Bcp.Data(buffer));
     }
 }