123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- .. 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/<name>/doc_classes.
- .. _class_PacketPeer:
- PacketPeer
- ==========
- **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
- **Inherited By:** :ref:`PacketPeerStream<class_PacketPeerStream>`, :ref:`PacketPeerUDP<class_PacketPeerUDP>`, :ref:`WebSocketPeer<class_WebSocketPeer>`, :ref:`PacketPeerGDNative<class_PacketPeerGDNative>`, :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>`
- **Category:** Core
- Brief Description
- -----------------
- Abstraction and base class for packet-based protocols.
- Properties
- ----------
- +-------------------------+----------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`allow_object_decoding<class_PacketPeer_allow_object_decoding>` |
- +-------------------------+----------------------------------------------------------------------+
- Methods
- -------
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_available_packet_count<class_PacketPeer_get_available_packet_count>` **(** **)** const |
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`get_packet<class_PacketPeer_get_packet>` **(** **)** |
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`get_packet_error<class_PacketPeer_get_packet_error>` **(** **)** const |
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`get_var<class_PacketPeer_get_var>` **(** **)** |
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`put_packet<class_PacketPeer_put_packet>` **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer **)** |
- +--------------------------------------------+-------------------------------------------------------------------------------------------------------------+
- | :ref:`Error<enum_@GlobalScope_Error>` | :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.
- Property Descriptions
- ---------------------
- .. _class_PacketPeer_allow_object_decoding:
- - :ref:`bool<class_bool>` **allow_object_decoding**
- +----------+----------------------------------+
- | *Setter* | set_allow_object_decoding(value) |
- +----------+----------------------------------+
- | *Getter* | is_object_decoding_allowed() |
- +----------+----------------------------------+
- Method Descriptions
- -------------------
- .. _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:`PoolByteArray<class_PoolByteArray>` **get_packet** **(** **)**
- Get a raw packet.
- .. _class_PacketPeer_get_packet_error:
- - :ref:`Error<enum_@GlobalScope_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** **(** **)**
- Get a Variant.
- .. _class_PacketPeer_put_packet:
- - :ref:`Error<enum_@GlobalScope_Error>` **put_packet** **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer **)**
- Send a raw packet.
- .. _class_PacketPeer_put_var:
- - :ref:`Error<enum_@GlobalScope_Error>` **put_var** **(** :ref:`Variant<class_Variant>` var **)**
- Send a Variant as a packet.
|