class_streampeertcp.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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_connect_to_host>` **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)** |
  16. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`disconnect_from_host<class_StreamPeerTCP_disconnect_from_host>` **(** **)** |
  18. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`String<class_String>` | :ref:`get_connected_host<class_StreamPeerTCP_get_connected_host>` **(** **)** const |
  20. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_connected_port<class_StreamPeerTCP_get_connected_port>` **(** **)** const |
  22. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Status<enum_StreamPeerTCP_Status>` | :ref:`get_status<class_StreamPeerTCP_get_status>` **(** **)** |
  24. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`is_connected_to_host<class_StreamPeerTCP_is_connected_to_host>` **(** **)** const |
  26. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_no_delay<class_StreamPeerTCP_set_no_delay>` **(** :ref:`bool<class_bool>` enabled **)** |
  28. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  29. Enumerations
  30. ------------
  31. .. _enum_StreamPeerTCP_Status:
  32. enum **Status**:
  33. - **STATUS_NONE** = **0** --- The initial status of the ``StreamPeerTCP``, also the status after a disconnect.
  34. - **STATUS_CONNECTING** = **1** --- A status representing a ``StreamPeerTCP`` that is connecting to a host.
  35. - **STATUS_CONNECTED** = **2** --- A status representing a ``StreamPeerTCP`` that is connected to a host.
  36. - **STATUS_ERROR** = **3** --- A status representing a ``StreamPeerTCP`` in error state.
  37. Description
  38. -----------
  39. TCP Stream peer. This object can be used to connect to TCP servers, or also is returned by a TCP server.
  40. Method Descriptions
  41. -------------------
  42. .. _class_StreamPeerTCP_connect_to_host:
  43. - :ref:`Error<enum_@GlobalScope_Error>` **connect_to_host** **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)**
  44. Connect to the specified host:port pair. A hostname will be resolved if valid. Returns OK on success or FAILED on failure.
  45. .. _class_StreamPeerTCP_disconnect_from_host:
  46. - void **disconnect_from_host** **(** **)**
  47. Disconnect from host.
  48. .. _class_StreamPeerTCP_get_connected_host:
  49. - :ref:`String<class_String>` **get_connected_host** **(** **)** const
  50. Return the IP of this peer.
  51. .. _class_StreamPeerTCP_get_connected_port:
  52. - :ref:`int<class_int>` **get_connected_port** **(** **)** const
  53. Return the port of this peer.
  54. .. _class_StreamPeerTCP_get_status:
  55. - :ref:`Status<enum_StreamPeerTCP_Status>` **get_status** **(** **)**
  56. Return the status of the connection, one of STATUS\_\* enum.
  57. .. _class_StreamPeerTCP_is_connected_to_host:
  58. - :ref:`bool<class_bool>` **is_connected_to_host** **(** **)** const
  59. Returns ``true`` if this peer is currently connected to a host, ``false[code] otherwise.
  60. .. _class_StreamPeerTCP_set_no_delay:
  61. - void **set_no_delay** **(** :ref:`bool<class_bool>` enabled **)**
  62. Disable Nagle algorithm to improve latency for small packets.
  63. Note that for applications that send large packets, or need to transfer a lot of data, this can reduce total bandwidth.