Thanks to some ideas from Pyrogine, I have now re-written my packet stuff so the packets are now Classes instead of records

The code is a bit more complex now, but I think it is more flexible in the long run.

You still create 'concrete' packet reader and writer classes to read/write the packets to wherever you want (Stream, UDP, TCP, etc).

You create new 'concrete' packet types by descending from TPacket_Base, overriding the WriteToStream and ReadFromStream methods so you control which fields in the class get written and read, and add a new cPacketID_ constant for that packet type.

You also override the Create method to set the PacketID to the correct type.

The base packet class even has its own Assign method that uses the 'concrete' packet classes' own WriteToStream and ReadFromStream methods so you can assign one packet to another of the same type without adding any extra code

You register the all the packet types you are going to use with the PacketReader instance you are using, and 'away you go'

So, if anyone is interested, here is the new code http://fpc4gp2x.eonclash.com/downloa...riter_test.zip

Enjoy

cheers,
Paul