class_packetpeerudp.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_PacketPeerUDP:
  4. PacketPeerUDP
  5. =============
  6. **Inherits:** :ref:`PacketPeer<class_packetpeer>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. UDP packet peer.
  11. Member Functions
  12. ----------------
  13. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`close<class_PacketPeerUDP_close>` **(** **)** |
  15. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`String<class_string>` | :ref:`get_packet_ip<class_PacketPeerUDP_get_packet_ip>` **(** **)** const |
  17. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`get_packet_port<class_PacketPeerUDP_get_packet_port>` **(** **)** const |
  19. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`is_listening<class_PacketPeerUDP_is_listening>` **(** **)** const |
  21. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | Error | :ref:`listen<class_PacketPeerUDP_listen>` **(** :ref:`int<class_int>` port, :ref:`String<class_string>` bind_address="*", :ref:`int<class_int>` recv_buf_size=65536 **)** |
  23. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`set_send_address<class_PacketPeerUDP_set_send_address>` **(** :ref:`String<class_string>` host, :ref:`int<class_int>` port **)** |
  25. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | Error | :ref:`wait<class_PacketPeerUDP_wait>` **(** **)** |
  27. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. Description
  29. -----------
  30. UDP packet peer. Can be used to send raw UDP packets as well as :ref:`Variant<class_variant>`\ s.
  31. Member Function Description
  32. ---------------------------
  33. .. _class_PacketPeerUDP_close:
  34. - void **close** **(** **)**
  35. Close the UDP socket the :ref:`PacketPeerUDP<class_packetpeerudp>` is currently listening on.
  36. .. _class_PacketPeerUDP_get_packet_ip:
  37. - :ref:`String<class_string>` **get_packet_ip** **(** **)** const
  38. Return the IP of the remote peer that sent the last packet(that was received with :ref:`get_packet<class_PacketPeerUDP_get_packet>` or :ref:`get_var<class_PacketPeerUDP_get_var>`).
  39. .. _class_PacketPeerUDP_get_packet_port:
  40. - :ref:`int<class_int>` **get_packet_port** **(** **)** const
  41. Return the port of the remote peer that sent the last packet(that was received with :ref:`get_packet<class_PacketPeerUDP_get_packet>` or :ref:`get_var<class_PacketPeerUDP_get_var>`).
  42. .. _class_PacketPeerUDP_is_listening:
  43. - :ref:`bool<class_bool>` **is_listening** **(** **)** const
  44. Return whether this :ref:`PacketPeerUDP<class_packetpeerudp>` is listening.
  45. .. _class_PacketPeerUDP_listen:
  46. - Error **listen** **(** :ref:`int<class_int>` port, :ref:`String<class_string>` bind_address="*", :ref:`int<class_int>` recv_buf_size=65536 **)**
  47. Make this :ref:`PacketPeerUDP<class_packetpeerudp>` listen on the "port" binding to "bind_address" with a buffer size "recv_buf_size".
  48. If "bind_address" is set as "\*" (default), the peer will listen on all available addresses (both IPv4 and IPv6).
  49. If "bind_address" is set as "0.0.0.0" (for IPv4) or "::" (for IPv6), the peer will listen on all available addresses matching that IP type.
  50. If "bind_address" is set to any valid address (e.g. "192.168.1.101", "::1", etc), the peer will only listen on the interface with that addresses (or fail if no interface with the given address exists).
  51. .. _class_PacketPeerUDP_set_send_address:
  52. - :ref:`int<class_int>` **set_send_address** **(** :ref:`String<class_string>` host, :ref:`int<class_int>` port **)**
  53. Set the destination address and port for sending packets and variables, a hostname will be resolved using if valid.
  54. .. _class_PacketPeerUDP_wait:
  55. - Error **wait** **(** **)**
  56. Wait for a packet to arrive on the listening port, see :ref:`listen<class_PacketPeerUDP_listen>`.