NetDatagram vs PyDatagram


I was looking over at panda3d and I notice we import NetDatagram but when we send a message, a PyDatagram is being used. I was wondering if someone could sort of clarify the difference in these two objects? Is there any situations I should use one or the other?


Datagram is the core Panda3D class representing datagrams and providing methods to write data to them.

PyDatagram is really just the same as the Datagram class (it inherits from Datagram), except that it extends it with three more methods. You don’t need to use PyDatagram unless you specifically know you need those convenience methods.

NetDatagram is similarly a subclass of Datagram, but it stores a additional Connection and NetAddress fields. It is used with ConnectionReader so that it can store the extra information of where the datagram came from.

Ah, alright. Thanks a bunch! This makes a lot of sense now. Appreciate your time!