public static byte[] GenerateHeader(byte cid, IPacket p) { byte[] toret = new byte[5]; toret[0] = (byte)((p.GetLength() + HEADERSIZE) << 8 >> 8); toret[1] = (byte)((p.GetLength() + HEADERSIZE) >> 8); toret[2] = cid; toret[3] = p.GetPacketType(); toret[4] = p.GetID(); return(toret); }
public void AsynSendAndGet(IPacket packet, receiveDelegate onReceive) { packet.SetID(packetID++); receiveRequestPool.Add(packet.GetID(), onReceive); Send(packet); }