class_packetpeer.rst 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the PacketPeer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_PacketPeer:
  5. PacketPeer
  6. ==========
  7. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`PacketPeerStream<class_packetpeerstream>`, :ref:`PacketPeerUDP<class_packetpeerudp>`, :ref:`NetworkedMultiplayerPeer<class_networkedmultiplayerpeer>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Abstraction and base class for packet-based protocols.
  13. Member Functions
  14. ----------------
  15. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`get_available_packet_count<class_PacketPeer_get_available_packet_count>` **(** **)** const |
  17. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`get_packet<class_PacketPeer_get_packet>` **(** **)** |
  19. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_packet_error<class_PacketPeer_get_packet_error>` **(** **)** const |
  21. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Variant<class_variant>` | :ref:`get_var<class_PacketPeer_get_var>` **(** **)** |
  23. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_object_decoding_allowed<class_PacketPeer_is_object_decoding_allowed>` **(** **)** const |
  25. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`put_packet<class_PacketPeer_put_packet>` **(** :ref:`PoolByteArray<class_poolbytearray>` buffer **)** |
  27. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`put_var<class_PacketPeer_put_var>` **(** :ref:`Variant<class_variant>` var **)** |
  29. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_allow_object_decoding<class_PacketPeer_set_allow_object_decoding>` **(** :ref:`bool<class_bool>` enable **)** |
  31. +--------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
  32. Description
  33. -----------
  34. 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.
  35. Member Function Description
  36. ---------------------------
  37. .. _class_PacketPeer_get_available_packet_count:
  38. - :ref:`int<class_int>` **get_available_packet_count** **(** **)** const
  39. Return the number of packets currently available in the ring-buffer.
  40. .. _class_PacketPeer_get_packet:
  41. - :ref:`PoolByteArray<class_poolbytearray>` **get_packet** **(** **)**
  42. Get a raw packet.
  43. .. _class_PacketPeer_get_packet_error:
  44. - :ref:`int<class_int>` **get_packet_error** **(** **)** const
  45. 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>`).
  46. .. _class_PacketPeer_get_var:
  47. - :ref:`Variant<class_variant>` **get_var** **(** **)**
  48. Get a Variant.
  49. .. _class_PacketPeer_is_object_decoding_allowed:
  50. - :ref:`bool<class_bool>` **is_object_decoding_allowed** **(** **)** const
  51. .. _class_PacketPeer_put_packet:
  52. - :ref:`int<class_int>` **put_packet** **(** :ref:`PoolByteArray<class_poolbytearray>` buffer **)**
  53. Send a raw packet.
  54. .. _class_PacketPeer_put_var:
  55. - :ref:`int<class_int>` **put_var** **(** :ref:`Variant<class_variant>` var **)**
  56. Send a Variant as a packet.
  57. .. _class_PacketPeer_set_allow_object_decoding:
  58. - void **set_allow_object_decoding** **(** :ref:`bool<class_bool>` enable **)**