StreamPeerTCP.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="StreamPeerTCP" inherits="StreamPeer" category="Core" version="3.1.2">
  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. </return>
  15. <argument index="0" name="host" type="String">
  16. </argument>
  17. <argument index="1" name="port" type="int">
  18. </argument>
  19. <description>
  20. Connect to the specified host:port pair. A hostname will be resolved if valid. Returns [constant @GlobalScope.OK] on success or [constant @GlobalScope.FAILED] on failure.
  21. </description>
  22. </method>
  23. <method name="disconnect_from_host">
  24. <return type="void">
  25. </return>
  26. <description>
  27. Disconnect from host.
  28. </description>
  29. </method>
  30. <method name="get_connected_host" qualifiers="const">
  31. <return type="String">
  32. </return>
  33. <description>
  34. Returns the IP of this peer.
  35. </description>
  36. </method>
  37. <method name="get_connected_port" qualifiers="const">
  38. <return type="int">
  39. </return>
  40. <description>
  41. Returns the port of this peer.
  42. </description>
  43. </method>
  44. <method name="get_status">
  45. <return type="int" enum="StreamPeerTCP.Status">
  46. </return>
  47. <description>
  48. Returns the status of the connection, see [enum StreamPeerTCP.Status].
  49. </description>
  50. </method>
  51. <method name="is_connected_to_host" qualifiers="const">
  52. <return type="bool">
  53. </return>
  54. <description>
  55. Returns [code]true[/code] if this peer is currently connected to a host, [code]false[/code] otherwise.
  56. </description>
  57. </method>
  58. <method name="set_no_delay">
  59. <return type="void">
  60. </return>
  61. <argument index="0" name="enabled" type="bool">
  62. </argument>
  63. <description>
  64. Disable Nagle algorithm to improve latency for small packets.
  65. Note that for applications that send large packets, or need to transfer a lot of data, this can reduce total bandwidth.
  66. </description>
  67. </method>
  68. </methods>
  69. <constants>
  70. <constant name="STATUS_NONE" value="0" enum="Status">
  71. The initial status of the [code]StreamPeerTCP[/code], also the status after a disconnect.
  72. </constant>
  73. <constant name="STATUS_CONNECTING" value="1" enum="Status">
  74. A status representing a [code]StreamPeerTCP[/code] that is connecting to a host.
  75. </constant>
  76. <constant name="STATUS_CONNECTED" value="2" enum="Status">
  77. A status representing a [code]StreamPeerTCP[/code] that is connected to a host.
  78. </constant>
  79. <constant name="STATUS_ERROR" value="3" enum="Status">
  80. A status representing a [code]StreamPeerTCP[/code] in error state.
  81. </constant>
  82. </constants>
  83. </class>