class_packetpeerudp.rst 5.7 KB

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