Esempio n. 1
0
        public void Send(int nID, byte[] data)
        {
            Peer c = GetPeer(nID);

            if (c == null)
            {
                return;
            }

            byte[] len  = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(data.Length));
            byte[] buff = new byte[len.Length + data.Length];
            Buffer.BlockCopy(len, 0, buff, 0, len.Length);
            Buffer.BlockCopy(data, 0, buff, len.Length, data.Length);

            SendBuff s = new SendBuff();

            s.peer = c;
            s.buff = buff;
            sendbuffers.Enqueue(s);
        }
Esempio n. 2
0
 internal void AddBuffer(byte[] buffer)
 {
     _recvbuffers.Enqueue(new ArraySegment <byte>(buffer));
 }