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(); }
public DonkeyHeader(MemoryStream buffer) { BinaryReader reader=new BinaryReader(buffer); eDonkeyID=(Protocol.ProtocolType)reader.ReadByte(); Packetlength=(uint)reader.ReadInt32(); Command=reader.ReadByte(); }
public DonkeyHeader(byte command,BinaryWriter writer,Protocol.ProtocolType protocol) { eDonkeyID=protocol; Command=command; Packetlength=6; Serialize(writer); }
public DonkeyHeader(byte command,Protocol.ProtocolType protocol) { eDonkeyID=protocol; Command=command; Packetlength=6; }
public DonkeyHeader(byte command) { eDonkeyID=Protocol.ProtocolType.eDonkey; Command=command; Packetlength=6; }