StreamPeerTCP.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="StreamPeerTCP" inherits="StreamPeer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. TCP stream peer.
  5. </brief_description>
  6. <description>
  7. TCP stream peer. This object can be used to connect to TCP servers, or also is returned by a TCP server.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="connect_to_host">
  13. <return type="int" enum="Error" />
  14. <argument index="0" name="host" type="String" />
  15. <argument index="1" name="port" type="int" />
  16. <description>
  17. Connects to the specified [code]host:port[/code] pair. A hostname will be resolved if valid. Returns [constant OK] on success or [constant FAILED] on failure.
  18. </description>
  19. </method>
  20. <method name="disconnect_from_host">
  21. <return type="void" />
  22. <description>
  23. Disconnects from host.
  24. </description>
  25. </method>
  26. <method name="get_connected_host" qualifiers="const">
  27. <return type="String" />
  28. <description>
  29. Returns the IP of this peer.
  30. </description>
  31. </method>
  32. <method name="get_connected_port" qualifiers="const">
  33. <return type="int" />
  34. <description>
  35. Returns the port of this peer.
  36. </description>
  37. </method>
  38. <method name="get_status">
  39. <return type="int" enum="StreamPeerTCP.Status" />
  40. <description>
  41. Returns the status of the connection, see [enum Status].
  42. </description>
  43. </method>
  44. <method name="is_connected_to_host" qualifiers="const">
  45. <return type="bool" />
  46. <description>
  47. Returns [code]true[/code] if this peer is currently connected or is connecting to a host, [code]false[/code] otherwise.
  48. </description>
  49. </method>
  50. <method name="set_no_delay">
  51. <return type="void" />
  52. <argument index="0" name="enabled" type="bool" />
  53. <description>
  54. If [code]enabled[/code] is [code]true[/code], packets will be sent immediately. If [code]enabled[/code] is [code]false[/code] (the default), packet transfers will be delayed and combined using [url=https://en.wikipedia.org/wiki/Nagle%27s_algorithm]Nagle's algorithm[/url].
  55. [b]Note:[/b] It's recommended to leave this disabled for applications that send large packets or need to transfer a lot of data, as enabling this can decrease the total available bandwidth.
  56. </description>
  57. </method>
  58. </methods>
  59. <constants>
  60. <constant name="STATUS_NONE" value="0" enum="Status">
  61. The initial status of the [StreamPeerTCP]. This is also the status after disconnecting.
  62. </constant>
  63. <constant name="STATUS_CONNECTING" value="1" enum="Status">
  64. A status representing a [StreamPeerTCP] that is connecting to a host.
  65. </constant>
  66. <constant name="STATUS_CONNECTED" value="2" enum="Status">
  67. A status representing a [StreamPeerTCP] that is connected to a host.
  68. </constant>
  69. <constant name="STATUS_ERROR" value="3" enum="Status">
  70. A status representing a [StreamPeerTCP] in error state.
  71. </constant>
  72. </constants>
  73. </class>