.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the PacketPeer.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_PacketPeer: PacketPeer ========== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`NetworkedMultiplayerPeer`, :ref:`PacketPeerGDNative`, :ref:`PacketPeerStream`, :ref:`PacketPeerUDP`, :ref:`WebSocketPeer` **Category:** Core Brief Description ----------------- Abstraction and base class for packet-based protocols. Properties ---------- +-------------------------+-------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`allow_object_decoding` | +-------------------------+-------------------------------------------------------------------------------+ Methods ------- +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_available_packet_count` **(** **)** const | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolByteArray` | :ref:`get_packet` **(** **)** | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`get_packet_error` **(** **)** const | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_var` **(** **)** | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`put_packet` **(** :ref:`PoolByteArray` buffer **)** | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`put_var` **(** :ref:`Variant` var **)** | +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ Description ----------- PacketPeer is an abstraction and base class for packet-based protocols (such as UDP). It provides an API for sending and receiving packets both as raw data or variables. This makes it easy to transfer data over a protocol, without having to encode data as low level bytes or having to worry about network ordering. Property Descriptions --------------------- .. _class_PacketPeer_property_allow_object_decoding: - :ref:`bool` **allow_object_decoding** +----------+----------------------------------+ | *Setter* | set_allow_object_decoding(value) | +----------+----------------------------------+ | *Getter* | is_object_decoding_allowed() | +----------+----------------------------------+ Method Descriptions ------------------- .. _class_PacketPeer_method_get_available_packet_count: - :ref:`int` **get_available_packet_count** **(** **)** const Return the number of packets currently available in the ring-buffer. .. _class_PacketPeer_method_get_packet: - :ref:`PoolByteArray` **get_packet** **(** **)** Get a raw packet. .. _class_PacketPeer_method_get_packet_error: - :ref:`Error` **get_packet_error** **(** **)** const Return the error state of the last packet received (via :ref:`get_packet` and :ref:`get_var`). .. _class_PacketPeer_method_get_var: - :ref:`Variant` **get_var** **(** **)** Get a Variant. .. _class_PacketPeer_method_put_packet: - :ref:`Error` **put_packet** **(** :ref:`PoolByteArray` buffer **)** Send a raw packet. .. _class_PacketPeer_method_put_var: - :ref:`Error` **put_var** **(** :ref:`Variant` var **)** Send a Variant as a packet.