TCP_Server.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. <description>
  15. Returns [code]true[/code] if a connection is available for taking.
  16. </description>
  17. </method>
  18. <method name="is_listening" qualifiers="const">
  19. <return type="bool" />
  20. <description>
  21. Returns [code]true[/code] if the server is currently listening for connections.
  22. </description>
  23. </method>
  24. <method name="listen">
  25. <return type="int" enum="Error" />
  26. <argument index="0" name="port" type="int" />
  27. <argument index="1" name="bind_address" type="String" default="&quot;*&quot;" />
  28. <description>
  29. Listen on the [code]port[/code] binding to [code]bind_address[/code].
  30. If [code]bind_address[/code] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6).
  31. 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.
  32. 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).
  33. </description>
  34. </method>
  35. <method name="stop">
  36. <return type="void" />
  37. <description>
  38. Stops listening.
  39. </description>
  40. </method>
  41. <method name="take_connection">
  42. <return type="StreamPeerTCP" />
  43. <description>
  44. If a connection is available, returns a StreamPeerTCP with the connection.
  45. </description>
  46. </method>
  47. </methods>
  48. <constants>
  49. </constants>
  50. </class>