/// <summary>
 /// Reads the next incoming packet.
 /// </summary>
 /// <returns></returns>
 public Packet ReadPacket ( ) {
     try {
         byte id = mReader.ReadByte();
         Packet p = Packet.GetPacket( ( PacketID ) id );
         if (p is Packets.PacketInvalid)
             throw new IOException("Received unknown packet");
         int len = PacketData.GetLength(remote.NetworkStream, remote.PacketOptions);
         byte[] data = new byte[len];
         PacketData pData = new PacketData(data, remote.PacketOptions);
         p.ReadPacket(pData);
         return p;
     }
     catch { return null; }
 }
示例#2
0
 public abstract void ReadPacket( PacketData data );