class_streampeertcp.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the StreamPeerTCP.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_StreamPeerTCP:
  5. StreamPeerTCP
  6. =============
  7. **Inherits:** :ref:`StreamPeer<class_StreamPeer>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. TCP Stream peer.
  12. Methods
  13. -------
  14. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_to_host<class_StreamPeerTCP_method_connect_to_host>` **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)** |
  16. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`disconnect_from_host<class_StreamPeerTCP_method_disconnect_from_host>` **(** **)** |
  18. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`String<class_String>` | :ref:`get_connected_host<class_StreamPeerTCP_method_get_connected_host>` **(** **)** const |
  20. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_connected_port<class_StreamPeerTCP_method_get_connected_port>` **(** **)** const |
  22. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Status<enum_StreamPeerTCP_Status>` | :ref:`get_status<class_StreamPeerTCP_method_get_status>` **(** **)** |
  24. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`is_connected_to_host<class_StreamPeerTCP_method_is_connected_to_host>` **(** **)** const |
  26. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_no_delay<class_StreamPeerTCP_method_set_no_delay>` **(** :ref:`bool<class_bool>` enabled **)** |
  28. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  29. Enumerations
  30. ------------
  31. .. _enum_StreamPeerTCP_Status:
  32. .. _class_StreamPeerTCP_constant_STATUS_NONE:
  33. .. _class_StreamPeerTCP_constant_STATUS_CONNECTING:
  34. .. _class_StreamPeerTCP_constant_STATUS_CONNECTED:
  35. .. _class_StreamPeerTCP_constant_STATUS_ERROR:
  36. enum **Status**:
  37. - **STATUS_NONE** = **0** --- The initial status of the ``StreamPeerTCP``, also the status after a disconnect.
  38. - **STATUS_CONNECTING** = **1** --- A status representing a ``StreamPeerTCP`` that is connecting to a host.
  39. - **STATUS_CONNECTED** = **2** --- A status representing a ``StreamPeerTCP`` that is connected to a host.
  40. - **STATUS_ERROR** = **3** --- A status representing a ``StreamPeerTCP`` in error state.
  41. Description
  42. -----------
  43. TCP Stream peer. This object can be used to connect to TCP servers, or also is returned by a TCP server.
  44. Method Descriptions
  45. -------------------
  46. .. _class_StreamPeerTCP_method_connect_to_host:
  47. - :ref:`Error<enum_@GlobalScope_Error>` **connect_to_host** **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)**
  48. Connect to the specified host:port pair. A hostname will be resolved if valid. Returns ``OK`` on success or ``FAILED`` on failure.
  49. .. _class_StreamPeerTCP_method_disconnect_from_host:
  50. - void **disconnect_from_host** **(** **)**
  51. Disconnect from host.
  52. .. _class_StreamPeerTCP_method_get_connected_host:
  53. - :ref:`String<class_String>` **get_connected_host** **(** **)** const
  54. Return the IP of this peer.
  55. .. _class_StreamPeerTCP_method_get_connected_port:
  56. - :ref:`int<class_int>` **get_connected_port** **(** **)** const
  57. Return the port of this peer.
  58. .. _class_StreamPeerTCP_method_get_status:
  59. - :ref:`Status<enum_StreamPeerTCP_Status>` **get_status** **(** **)**
  60. Return the status of the connection, see :ref:`Status<enum_StreamPeerTCP_Status>`.
  61. .. _class_StreamPeerTCP_method_is_connected_to_host:
  62. - :ref:`bool<class_bool>` **is_connected_to_host** **(** **)** const
  63. Returns ``true`` if this peer is currently connected to a host, ``false`` otherwise.
  64. .. _class_StreamPeerTCP_method_set_no_delay:
  65. - void **set_no_delay** **(** :ref:`bool<class_bool>` enabled **)**
  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.