.. 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:`PacketPeerStream`, :ref:`PacketPeerUDP`, :ref:`NetworkedMultiplayerPeer` **Category:** Core Brief Description ----------------- Abstraction and base class for packet-based protocols. Member Functions ---------------- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_available_packet_count` **(** **)** const | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolByteArray` | :ref:`get_packet` **(** **)** | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_packet_error` **(** **)** const | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_var` **(** **)** | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_object_decoding_allowed` **(** **)** const | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`put_packet` **(** :ref:`PoolByteArray` buffer **)** | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`put_var` **(** :ref:`Variant` var **)** | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_allow_object_decoding` **(** :ref:`bool` enable **)** | +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ 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. Member Function Description --------------------------- .. _class_PacketPeer_get_available_packet_count: - :ref:`int` **get_available_packet_count** **(** **)** const Return the number of packets currently available in the ring-buffer. .. _class_PacketPeer_get_packet: - :ref:`PoolByteArray` **get_packet** **(** **)** Get a raw packet. .. _class_PacketPeer_get_packet_error: - :ref:`int` **get_packet_error** **(** **)** const Return the error state of the last packet received (via :ref:`get_packet` and :ref:`get_var`). .. _class_PacketPeer_get_var: - :ref:`Variant` **get_var** **(** **)** Get a Variant. .. _class_PacketPeer_is_object_decoding_allowed: - :ref:`bool` **is_object_decoding_allowed** **(** **)** const .. _class_PacketPeer_put_packet: - :ref:`int` **put_packet** **(** :ref:`PoolByteArray` buffer **)** Send a raw packet. .. _class_PacketPeer_put_var: - :ref:`int` **put_var** **(** :ref:`Variant` var **)** Send a Variant as a packet. .. _class_PacketPeer_set_allow_object_decoding: - void **set_allow_object_decoding** **(** :ref:`bool` enable **)**