12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_PacketPeer:
- PacketPeer
- ==========
- **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
- **Inherited By:** :ref:`PacketPeerStream<class_packetpeerstream>`, :ref:`PacketPeerUDP<class_packetpeerudp>`
- **Category:** Core
- Brief Description
- -----------------
- Abstraction and base class for packet-based protocols.
- Member Functions
- ----------------
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_available_packet_count<class_PacketPeer_get_available_packet_count>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | :ref:`RawArray<class_rawarray>` | :ref:`get_packet<class_PacketPeer_get_packet>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | Error | :ref:`get_packet_error<class_PacketPeer_get_packet_error>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_variant>` | :ref:`get_var<class_PacketPeer_get_var>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | Error | :ref:`put_packet<class_PacketPeer_put_packet>` **(** :ref:`RawArray<class_rawarray>` buffer **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`put_var<class_PacketPeer_put_var>` **(** :ref:`Variant<class_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.
- Member Function Description
- ---------------------------
- .. _class_PacketPeer_get_available_packet_count:
- - :ref:`int<class_int>` **get_available_packet_count** **(** **)** const
- Return the number of packets currently available in the ring-buffer.
- .. _class_PacketPeer_get_packet:
- - :ref:`RawArray<class_rawarray>` **get_packet** **(** **)** const
- Get a raw packet.
- .. _class_PacketPeer_get_packet_error:
- - Error **get_packet_error** **(** **)** const
- Return the error state of the last packet received (via :ref:`get_packet<class_PacketPeer_get_packet>` and :ref:`get_var<class_PacketPeer_get_var>`).
- .. _class_PacketPeer_get_var:
- - :ref:`Variant<class_variant>` **get_var** **(** **)** const
- Get a Variant.
- .. _class_PacketPeer_put_packet:
- - Error **put_packet** **(** :ref:`RawArray<class_rawarray>` buffer **)**
- Send a raw packet.
- .. _class_PacketPeer_put_var:
- - :ref:`int<class_int>` **put_var** **(** :ref:`Variant<class_variant>` var **)**
- Send a Variant as a packet.
|