EnetEvent

class EnetEvent

Bases: ReferenceCount

A single event returned by EnetHost::service(): a new connection, a disconnection, or a received packet. For T_receive events the packet payload is copied into the event and the underlying ENet packet is released immediately, so events may be kept around freely.

Inheritance diagram

digraph inheritance6c8d987a85 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "EnetEvent" [URL="acron.enet.EnetEvent.html#acron.enet.EnetEvent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "ReferenceCount" -> "EnetEvent" [arrowsize=0.75,style=""]; "ReferenceCount" [URL="acron.core.ReferenceCount.html#acron.core.ReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ReferenceCount" [arrowsize=0.75,style=""]; }
enum Type

Mirrors ENET_EVENT_TYPE_*.

enumerator T_none = 0
enumerator T_connect = 1
enumerator T_disconnect = 2
enumerator T_receive = 3
EnetEvent.__init__()
EnetEvent.get_channel()
EnetEvent.get_data()

The payload of a T_receive event. Maps to bytes in Python.

The payload of a T_receive event. Maps to bytes in Python.

EnetEvent.get_datagram()

The payload wrapped in a Datagram, for use with DatagramIterator. Note that, as with any Datagram, you must keep it alive (e.g. assigned to a variable) for as long as a DatagramIterator is reading from it.

Returns the payload of a T_receive event wrapped in a Datagram, ready to be read with a DatagramIterator.

EnetEvent.get_event_data()

The user-supplied data field: for T_connect this is the value passed to connect(), for T_disconnect the value passed to disconnect().

The user-supplied data field: for T_connect this is the value passed to connect(), for T_disconnect the value passed to disconnect().

EnetEvent.get_packet_flags()

The ENet packet flags of a received packet (see EnetPeer::PacketFlag).

The ENet packet flags of a received packet (see EnetPeer::PacketFlag).

EnetEvent.get_peer()
EnetEvent.get_type()
EnetEvent.output()