class_streampeertcp.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. Member Functions
  13. ----------------
  14. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`int<class_int>` | :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:`int<class_int>` | :ref:`get_status<class_StreamPeerTCP_get_status>` **(** **)** const |
  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. Enums
  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 staus 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. Member Function Description
  41. ---------------------------
  42. .. _class_StreamPeerTCP_connect_to_host:
  43. - :ref:`int<class_int>` **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:`int<class_int>` **get_status** **(** **)** const
  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. .. _class_StreamPeerTCP_set_no_delay:
  60. - void **set_no_delay** **(** :ref:`bool<class_bool>` enabled **)**
  61. Disable Nagle algorithm to improve latency for small packets.
  62. Note that for applications that send large packets, or need to transfer a lot of data, this can reduce total bandwidth.