PacketPeerUDP.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PacketPeerUDP" inherits="PacketPeer" category="Core" version="3.1.2">
  3. <brief_description>
  4. UDP packet peer.
  5. </brief_description>
  6. <description>
  7. UDP packet peer. Can be used to send raw UDP packets as well as [Variant]s.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="close">
  13. <return type="void">
  14. </return>
  15. <description>
  16. Close the UDP socket the [code]PacketPeerUDP[/code] is currently listening on.
  17. </description>
  18. </method>
  19. <method name="get_packet_ip" qualifiers="const">
  20. <return type="String">
  21. </return>
  22. <description>
  23. Returns the IP of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
  24. </description>
  25. </method>
  26. <method name="get_packet_port" qualifiers="const">
  27. <return type="int">
  28. </return>
  29. <description>
  30. Returns the port of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
  31. </description>
  32. </method>
  33. <method name="is_listening" qualifiers="const">
  34. <return type="bool">
  35. </return>
  36. <description>
  37. Returns whether this [code]PacketPeerUDP[/code] is listening.
  38. </description>
  39. </method>
  40. <method name="listen">
  41. <return type="int" enum="Error">
  42. </return>
  43. <argument index="0" name="port" type="int">
  44. </argument>
  45. <argument index="1" name="bind_address" type="String" default="&quot;*&quot;">
  46. </argument>
  47. <argument index="2" name="recv_buf_size" type="int" default="65536">
  48. </argument>
  49. <description>
  50. Make this [code]PacketPeerUDP[/code] listen on the "port" binding to "bind_address" with a buffer size "recv_buf_size".
  51. If "bind_address" is set as "*" (default), the peer will listen on all available addresses (both IPv4 and IPv6).
  52. 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.
  53. 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).
  54. </description>
  55. </method>
  56. <method name="set_dest_address">
  57. <return type="int" enum="Error">
  58. </return>
  59. <argument index="0" name="host" type="String">
  60. </argument>
  61. <argument index="1" name="port" type="int">
  62. </argument>
  63. <description>
  64. Set the destination address and port for sending packets and variables, a hostname will be resolved using if valid.
  65. </description>
  66. </method>
  67. <method name="wait">
  68. <return type="int" enum="Error">
  69. </return>
  70. <description>
  71. Wait for a packet to arrive on the listening port, see [method listen].
  72. </description>
  73. </method>
  74. </methods>
  75. <constants>
  76. </constants>
  77. </class>