StreamPeerTCP.xml 2.7 KB

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