Esempio n. 1
0
        private void m_OnUDPPacketReceived(IAsyncResult ar)
        {
            int nbytesRecibidos = 0;

            try
            {
                nbytesRecibidos = m_UDPListenerSocket.EndReceiveFrom(ar, ref m_RemoteEndPoint);
            }
            catch
            {}
            if (nbytesRecibidos > 0)
            {
                Protocol.ProtocolType protocol = (Protocol.ProtocolType)m_UDPReceivePacket[0];
                if (protocol == Protocol.ProtocolType.eMule)
                {
                    byte         Comando = m_UDPReceivePacket[1];
                    MemoryStream buffer  = new MemoryStream(m_UDPReceivePacket, 2, nbytesRecibidos - 2);
                    m_ProcessUDPPacket(Comando, ref buffer);
                }
                else if (protocol == Protocol.ProtocolType.eDonkey)
                {
                    byte         Comando = m_UDPReceivePacket[1];
                    MemoryStream buffer  = new MemoryStream(m_UDPReceivePacket, 2, nbytesRecibidos - 2);
                    m_ProcessServerUDPPacket(Comando, ref buffer);
                }
            }
            m_ReceivePacket();
        }
Esempio n. 2
0
 public DonkeyHeader(MemoryStream buffer)
 {
     BinaryReader reader=new BinaryReader(buffer);
     eDonkeyID=(Protocol.ProtocolType)reader.ReadByte();
     Packetlength=(uint)reader.ReadInt32();
     Command=reader.ReadByte();
 }
Esempio n. 3
0
 public DonkeyHeader(byte command,BinaryWriter writer,Protocol.ProtocolType protocol)
 {
     eDonkeyID=protocol;
     Command=command;
     Packetlength=6;
     Serialize(writer);
 }
Esempio n. 4
0
 public DonkeyHeader(byte command,Protocol.ProtocolType protocol)
 {
     eDonkeyID=protocol;
     Command=command;
     Packetlength=6;
 }
Esempio n. 5
0
 public DonkeyHeader(byte command)
 {
     eDonkeyID=Protocol.ProtocolType.eDonkey;
     Command=command;
     Packetlength=6;
 }