panda3d.core.RecentConnectionReader

class RecentConnectionReader

Bases: ConnectionReader

This flavor of ConnectionReader will read from its sockets and retain only the single most recent datagram for inspection by client code. It’s useful particularly for reading telemetry-type data from UDP sockets where you don’t care about getting every last socket, and in fact if the sockets are coming too fast you’d prefer to skip some of them.

This class will always create one thread for itself.

Inheritance diagram

Inheritance diagram of RecentConnectionReader

__init__(manager: ConnectionManager) → None
dataAvailable() → bool

Returns true if a datagram is available on the queue; call getData() to extract the datagram.

getData(result: Datagram) → bool

This flavor of RecentConnectionReader.getData(), works like the other, except that it only fills a Datagram object, not a NetDatagram object. This means that the Datagram cannot be queried for its source Connection and/or NetAddress, but it is useful in all other respects.

getData(result: NetDatagram) → bool

If a previous call to dataAvailable() returned true, this function will return the datagram that has become available.

The return value is true if a datagram was successfully returned, or false if there was, in fact, no datagram available. (This may happen if there are multiple threads accessing the RecentConnectionReader).