PacketPeerUDP.xml 2.8 KB

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