mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
95 lines
5.0 KiB
ReStructuredText
95 lines
5.0 KiB
ReStructuredText
.. 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:`NetworkedMultiplayerPeer<class_networkedmultiplayerpeer>`
|
|
|
|
**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:`PoolByteArray<class_poolbytearray>` | :ref:`get_packet<class_PacketPeer_get_packet>` **(** **)** |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_packet_error<class_PacketPeer_get_packet_error>` **(** **)** const |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Variant<class_variant>` | :ref:`get_var<class_PacketPeer_get_var>` **(** **)** |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_object_decoding_allowed<class_PacketPeer_is_object_decoding_allowed>` **(** **)** const |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`put_packet<class_PacketPeer_put_packet>` **(** :ref:`PoolByteArray<class_poolbytearray>` buffer **)** |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`put_var<class_PacketPeer_put_var>` **(** :ref:`Variant<class_variant>` var **)** |
|
|
+--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_allow_object_decoding<class_PacketPeer_set_allow_object_decoding>` **(** :ref:`bool<class_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<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:`int<class_int>` **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_is_object_decoding_allowed:
|
|
|
|
- :ref:`bool<class_bool>` **is_object_decoding_allowed** **(** **)** const
|
|
|
|
.. _class_PacketPeer_put_packet:
|
|
|
|
- :ref:`int<class_int>` **put_packet** **(** :ref:`PoolByteArray<class_poolbytearray>` 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.
|
|
|
|
.. _class_PacketPeer_set_allow_object_decoding:
|
|
|
|
- void **set_allow_object_decoding** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
|