class_streampeertcp.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_StreamPeerTCP:
  4. StreamPeerTCP
  5. =============
  6. **Inherits:** :ref:`StreamPeer<class_streampeer>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. TCP Stream peer.
  11. Member Functions
  12. ----------------
  13. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`int<class_int>` | :ref:`connect<class_StreamPeerTCP_connect>` **(** :ref:`String<class_string>` host, :ref:`int<class_int>` port **)** |
  15. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`disconnect<class_StreamPeerTCP_disconnect>` **(** **)** |
  17. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`String<class_string>` | :ref:`get_connected_host<class_StreamPeerTCP_get_connected_host>` **(** **)** const |
  19. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_connected_port<class_StreamPeerTCP_get_connected_port>` **(** **)** const |
  21. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | :ref:`get_status<class_StreamPeerTCP_get_status>` **(** **)** const |
  23. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_connected<class_StreamPeerTCP_is_connected>` **(** **)** const |
  25. +------------------------------+------------------------------------------------------------------------------------------------------------------------+
  26. Numeric Constants
  27. -----------------
  28. - **STATUS_NONE** = **0** --- The initial status of the :ref:`StreamPeerTCP<class_streampeertcp>`, also the status after a disconnect.
  29. - **STATUS_CONNECTING** = **1** --- A status representing a :ref:`StreamPeerTCP<class_streampeertcp>` that is connecting to a host.
  30. - **STATUS_CONNECTED** = **2** --- A status representing a :ref:`StreamPeerTCP<class_streampeertcp>` that is connected to a host.
  31. - **STATUS_ERROR** = **3** --- A staus representing a :ref:`StreamPeerTCP<class_streampeertcp>` in error state.
  32. Description
  33. -----------
  34. TCP Stream peer. This object can be used to connect to TCP servers, or also is returned by a tcp server.
  35. Member Function Description
  36. ---------------------------
  37. .. _class_StreamPeerTCP_connect:
  38. - :ref:`int<class_int>` **connect** **(** :ref:`String<class_string>` host, :ref:`int<class_int>` port **)**
  39. Connect to the specified host:port pair. A hostname will be resolved if valid. Returns OK on success or FAILED on failure.
  40. .. _class_StreamPeerTCP_disconnect:
  41. - void **disconnect** **(** **)**
  42. Disconnect from host.
  43. .. _class_StreamPeerTCP_get_connected_host:
  44. - :ref:`String<class_string>` **get_connected_host** **(** **)** const
  45. Return the IP of this peer.
  46. .. _class_StreamPeerTCP_get_connected_port:
  47. - :ref:`int<class_int>` **get_connected_port** **(** **)** const
  48. Return the port of this peer.
  49. .. _class_StreamPeerTCP_get_status:
  50. - :ref:`int<class_int>` **get_status** **(** **)** const
  51. Return the status of the connection, one of STATUS\_\* enum.
  52. .. _class_StreamPeerTCP_is_connected:
  53. - :ref:`bool<class_bool>` **is_connected** **(** **)** const
  54. Return whether this peer is connected. Returns true while connecting and connected.