TCP_Server.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TCP_Server" inherits="Reference" version="3.3">
  3. <brief_description>
  4. A TCP server.
  5. </brief_description>
  6. <description>
  7. A TCP server. Listens to connections on a port and returns a [StreamPeerTCP] when it gets an incoming connection.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="is_connection_available" qualifiers="const">
  13. <return type="bool">
  14. </return>
  15. <description>
  16. Returns [code]true[/code] if a connection is available for taking.
  17. </description>
  18. </method>
  19. <method name="is_listening" qualifiers="const">
  20. <return type="bool">
  21. </return>
  22. <description>
  23. Returns [code]true[/code] if the server is currently listening for connections.
  24. </description>
  25. </method>
  26. <method name="listen">
  27. <return type="int" enum="Error">
  28. </return>
  29. <argument index="0" name="port" type="int">
  30. </argument>
  31. <argument index="1" name="bind_address" type="String" default="&quot;*&quot;">
  32. </argument>
  33. <description>
  34. Listen on the [code]port[/code] binding to [code]bind_address[/code].
  35. If [code]bind_address[/code] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6).
  36. If [code]bind_address[/code] is set as [code]"0.0.0.0"[/code] (for IPv4) or [code]"::"[/code] (for IPv6), the server will listen on all available addresses matching that IP type.
  37. If [code]bind_address[/code] is set to any valid address (e.g. [code]"192.168.1.101"[/code], [code]"::1"[/code], etc), the server will only listen on the interface with that addresses (or fail if no interface with the given address exists).
  38. </description>
  39. </method>
  40. <method name="stop">
  41. <return type="void">
  42. </return>
  43. <description>
  44. Stops listening.
  45. </description>
  46. </method>
  47. <method name="take_connection">
  48. <return type="StreamPeerTCP">
  49. </return>
  50. <description>
  51. If a connection is available, returns a StreamPeerTCP with the connection.
  52. </description>
  53. </method>
  54. </methods>
  55. <constants>
  56. </constants>
  57. </class>