class_enetpacketpeer.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/modules/enet/doc_classes/ENetPacketPeer.xml.
  6. .. _class_ENetPacketPeer:
  7. ENetPacketPeer
  8. ==============
  9. **Inherits:** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A wrapper class for an `ENetPeer <http://enet.bespin.org/group__peer.html>`__.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A PacketPeer implementation representing a peer of an :ref:`ENetConnection<class_ENetConnection>`.
  15. This class cannot be instantiated directly but can be retrieved during :ref:`ENetConnection.service<class_ENetConnection_method_service>` or via :ref:`ENetConnection.get_peers<class_ENetConnection_method_get_peers>`.
  16. \ **Note:** When exporting to Android, make sure to enable the ``INTERNET`` permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - `API documentation on the ENet website <http://enet.bespin.org/usergroup0.html>`__
  21. .. rst-class:: classref-reftable-group
  22. Methods
  23. -------
  24. .. table::
  25. :widths: auto
  26. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_channels<class_ENetPacketPeer_method_get_channels>` **(** **)** |const| |
  28. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_String>` | :ref:`get_remote_address<class_ENetPacketPeer_method_get_remote_address>` **(** **)** |const| |
  30. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_remote_port<class_ENetPacketPeer_method_get_remote_port>` **(** **)** |const| |
  32. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`PeerState<enum_ENetPacketPeer_PeerState>` | :ref:`get_state<class_ENetPacketPeer_method_get_state>` **(** **)** |const| |
  34. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`get_statistic<class_ENetPacketPeer_method_get_statistic>` **(** :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` statistic **)** |
  36. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_active<class_ENetPacketPeer_method_is_active>` **(** **)** |const| |
  38. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`peer_disconnect<class_ENetPacketPeer_method_peer_disconnect>` **(** :ref:`int<class_int>` data=0 **)** |
  40. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`peer_disconnect_later<class_ENetPacketPeer_method_peer_disconnect_later>` **(** :ref:`int<class_int>` data=0 **)** |
  42. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`peer_disconnect_now<class_ENetPacketPeer_method_peer_disconnect_now>` **(** :ref:`int<class_int>` data=0 **)** |
  44. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`ping<class_ENetPacketPeer_method_ping>` **(** **)** |
  46. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`ping_interval<class_ENetPacketPeer_method_ping_interval>` **(** :ref:`int<class_int>` ping_interval **)** |
  48. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`reset<class_ENetPacketPeer_method_reset>` **(** **)** |
  50. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`send<class_ENetPacketPeer_method_send>` **(** :ref:`int<class_int>` channel, :ref:`PackedByteArray<class_PackedByteArray>` packet, :ref:`int<class_int>` flags **)** |
  52. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`set_timeout<class_ENetPacketPeer_method_set_timeout>` **(** :ref:`int<class_int>` timeout, :ref:`int<class_int>` timeout_min, :ref:`int<class_int>` timeout_max **)** |
  54. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`throttle_configure<class_ENetPacketPeer_method_throttle_configure>` **(** :ref:`int<class_int>` interval, :ref:`int<class_int>` acceleration, :ref:`int<class_int>` deceleration **)** |
  56. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Enumerations
  61. ------------
  62. .. _enum_ENetPacketPeer_PeerState:
  63. .. rst-class:: classref-enumeration
  64. enum **PeerState**:
  65. .. _class_ENetPacketPeer_constant_STATE_DISCONNECTED:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECTED** = ``0``
  68. The peer is disconnected.
  69. .. _class_ENetPacketPeer_constant_STATE_CONNECTING:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTING** = ``1``
  72. The peer is currently attempting to connect.
  73. .. _class_ENetPacketPeer_constant_STATE_ACKNOWLEDGING_CONNECT:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ACKNOWLEDGING_CONNECT** = ``2``
  76. The peer has acknowledged the connection request.
  77. .. _class_ENetPacketPeer_constant_STATE_CONNECTION_PENDING:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTION_PENDING** = ``3``
  80. The peer is currently connecting.
  81. .. _class_ENetPacketPeer_constant_STATE_CONNECTION_SUCCEEDED:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTION_SUCCEEDED** = ``4``
  84. The peer has successfully connected, but is not ready to communicate with yet (:ref:`STATE_CONNECTED<class_ENetPacketPeer_constant_STATE_CONNECTED>`).
  85. .. _class_ENetPacketPeer_constant_STATE_CONNECTED:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTED** = ``5``
  88. The peer is currently connected and ready to communicate with.
  89. .. _class_ENetPacketPeer_constant_STATE_DISCONNECT_LATER:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECT_LATER** = ``6``
  92. The peer is slated to disconnect after it has no more outgoing packets to send.
  93. .. _class_ENetPacketPeer_constant_STATE_DISCONNECTING:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECTING** = ``7``
  96. The peer is currently disconnecting.
  97. .. _class_ENetPacketPeer_constant_STATE_ACKNOWLEDGING_DISCONNECT:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ACKNOWLEDGING_DISCONNECT** = ``8``
  100. The peer has acknowledged the disconnection request.
  101. .. _class_ENetPacketPeer_constant_STATE_ZOMBIE:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ZOMBIE** = ``9``
  104. The peer has lost connection, but is not considered truly disconnected (as the peer didn't acknowledge the disconnection request).
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _enum_ENetPacketPeer_PeerStatistic:
  108. .. rst-class:: classref-enumeration
  109. enum **PeerStatistic**:
  110. .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS:
  111. .. rst-class:: classref-enumeration-constant
  112. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS** = ``0``
  113. Mean packet loss of reliable packets as a ratio with respect to the :ref:`PACKET_LOSS_SCALE<class_ENetPacketPeer_constant_PACKET_LOSS_SCALE>`.
  114. .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS_VARIANCE:
  115. .. rst-class:: classref-enumeration-constant
  116. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS_VARIANCE** = ``1``
  117. Packet loss variance.
  118. .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS_EPOCH:
  119. .. rst-class:: classref-enumeration-constant
  120. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS_EPOCH** = ``2``
  121. The time at which packet loss statistics were last updated (in milliseconds since the connection started). The interval for packet loss statistics updates is 10 seconds, and at least one packet must have been sent since the last statistics update.
  122. .. _class_ENetPacketPeer_constant_PEER_ROUND_TRIP_TIME:
  123. .. rst-class:: classref-enumeration-constant
  124. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_ROUND_TRIP_TIME** = ``3``
  125. Mean packet round trip time for reliable packets.
  126. .. _class_ENetPacketPeer_constant_PEER_ROUND_TRIP_TIME_VARIANCE:
  127. .. rst-class:: classref-enumeration-constant
  128. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_ROUND_TRIP_TIME_VARIANCE** = ``4``
  129. Variance of the mean round trip time.
  130. .. _class_ENetPacketPeer_constant_PEER_LAST_ROUND_TRIP_TIME:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_LAST_ROUND_TRIP_TIME** = ``5``
  133. Last recorded round trip time for a reliable packet.
  134. .. _class_ENetPacketPeer_constant_PEER_LAST_ROUND_TRIP_TIME_VARIANCE:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_LAST_ROUND_TRIP_TIME_VARIANCE** = ``6``
  137. Variance of the last trip time recorded.
  138. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE** = ``7``
  141. The peer's current throttle status.
  142. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_LIMIT:
  143. .. rst-class:: classref-enumeration-constant
  144. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_LIMIT** = ``8``
  145. The maximum number of unreliable packets that should not be dropped. This value is always greater than or equal to ``1``. The initial value is equal to :ref:`PACKET_THROTTLE_SCALE<class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE>`.
  146. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_COUNTER:
  147. .. rst-class:: classref-enumeration-constant
  148. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_COUNTER** = ``9``
  149. Internal value used to increment the packet throttle counter. The value is hardcoded to ``7`` and cannot be changed. You probably want to look at :ref:`PEER_PACKET_THROTTLE_ACCELERATION<class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_ACCELERATION>` instead.
  150. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_EPOCH:
  151. .. rst-class:: classref-enumeration-constant
  152. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_EPOCH** = ``10``
  153. The time at which throttle statistics were last updated (in milliseconds since the connection started). The interval for throttle statistics updates is :ref:`PEER_PACKET_THROTTLE_INTERVAL<class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_INTERVAL>`.
  154. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_ACCELERATION:
  155. .. rst-class:: classref-enumeration-constant
  156. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_ACCELERATION** = ``11``
  157. The throttle's acceleration factor. Higher values will make ENet adapt to fluctuating network conditions faster, causing unrelaible packets to be sent *more* often. The default value is ``2``.
  158. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_DECELERATION:
  159. .. rst-class:: classref-enumeration-constant
  160. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_DECELERATION** = ``12``
  161. The throttle's deceleration factor. Higher values will make ENet adapt to fluctuating network conditions faster, causing unrelaible packets to be sent *less* often. The default value is ``2``.
  162. .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_INTERVAL:
  163. .. rst-class:: classref-enumeration-constant
  164. :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_INTERVAL** = ``13``
  165. The interval over which the lowest mean round trip time should be measured for use by the throttle mechanism (in milliseconds). The default value is ``5000``.
  166. .. rst-class:: classref-section-separator
  167. ----
  168. .. rst-class:: classref-descriptions-group
  169. Constants
  170. ---------
  171. .. _class_ENetPacketPeer_constant_PACKET_LOSS_SCALE:
  172. .. rst-class:: classref-constant
  173. **PACKET_LOSS_SCALE** = ``65536``
  174. The reference scale for packet loss. See :ref:`get_statistic<class_ENetPacketPeer_method_get_statistic>` and :ref:`PEER_PACKET_LOSS<class_ENetPacketPeer_constant_PEER_PACKET_LOSS>`.
  175. .. _class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE:
  176. .. rst-class:: classref-constant
  177. **PACKET_THROTTLE_SCALE** = ``32``
  178. The reference value for throttle configuration. The default value is ``32``. See :ref:`throttle_configure<class_ENetPacketPeer_method_throttle_configure>`.
  179. .. _class_ENetPacketPeer_constant_FLAG_RELIABLE:
  180. .. rst-class:: classref-constant
  181. **FLAG_RELIABLE** = ``1``
  182. Mark the packet to be sent as reliable.
  183. .. _class_ENetPacketPeer_constant_FLAG_UNSEQUENCED:
  184. .. rst-class:: classref-constant
  185. **FLAG_UNSEQUENCED** = ``2``
  186. Mark the packet to be sent unsequenced (unreliable).
  187. .. _class_ENetPacketPeer_constant_FLAG_UNRELIABLE_FRAGMENT:
  188. .. rst-class:: classref-constant
  189. **FLAG_UNRELIABLE_FRAGMENT** = ``8``
  190. Mark the packet to be sent unreliable even if the packet is too big and needs fragmentation (increasing the chance of it being dropped).
  191. .. rst-class:: classref-section-separator
  192. ----
  193. .. rst-class:: classref-descriptions-group
  194. Method Descriptions
  195. -------------------
  196. .. _class_ENetPacketPeer_method_get_channels:
  197. .. rst-class:: classref-method
  198. :ref:`int<class_int>` **get_channels** **(** **)** |const|
  199. Returns the number of channels allocated for communication with peer.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_ENetPacketPeer_method_get_remote_address:
  203. .. rst-class:: classref-method
  204. :ref:`String<class_String>` **get_remote_address** **(** **)** |const|
  205. Returns the IP address of this peer.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_ENetPacketPeer_method_get_remote_port:
  209. .. rst-class:: classref-method
  210. :ref:`int<class_int>` **get_remote_port** **(** **)** |const|
  211. Returns the remote port of this peer.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_ENetPacketPeer_method_get_state:
  215. .. rst-class:: classref-method
  216. :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **get_state** **(** **)** |const|
  217. Returns the current peer state. See :ref:`PeerState<enum_ENetPacketPeer_PeerState>`.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_ENetPacketPeer_method_get_statistic:
  221. .. rst-class:: classref-method
  222. :ref:`float<class_float>` **get_statistic** **(** :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` statistic **)**
  223. Returns the requested ``statistic`` for this peer. See :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>`.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_ENetPacketPeer_method_is_active:
  227. .. rst-class:: classref-method
  228. :ref:`bool<class_bool>` **is_active** **(** **)** |const|
  229. Returns ``true`` if the peer is currently active (i.e. the associated :ref:`ENetConnection<class_ENetConnection>` is still valid).
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_ENetPacketPeer_method_peer_disconnect:
  233. .. rst-class:: classref-method
  234. void **peer_disconnect** **(** :ref:`int<class_int>` data=0 **)**
  235. Request a disconnection from a peer. An :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` will be generated during :ref:`ENetConnection.service<class_ENetConnection_method_service>` once the disconnection is complete.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_ENetPacketPeer_method_peer_disconnect_later:
  239. .. rst-class:: classref-method
  240. void **peer_disconnect_later** **(** :ref:`int<class_int>` data=0 **)**
  241. Request a disconnection from a peer, but only after all queued outgoing packets are sent. An :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` will be generated during :ref:`ENetConnection.service<class_ENetConnection_method_service>` once the disconnection is complete.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_ENetPacketPeer_method_peer_disconnect_now:
  245. .. rst-class:: classref-method
  246. void **peer_disconnect_now** **(** :ref:`int<class_int>` data=0 **)**
  247. Force an immediate disconnection from a peer. No :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` will be generated. The foreign peer is not guaranteed to receive the disconnect notification, and is reset immediately upon return from this function.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_ENetPacketPeer_method_ping:
  251. .. rst-class:: classref-method
  252. void **ping** **(** **)**
  253. Sends a ping request to a peer. ENet automatically pings all connected peers at regular intervals, however, this function may be called to ensure more frequent ping requests.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_ENetPacketPeer_method_ping_interval:
  257. .. rst-class:: classref-method
  258. void **ping_interval** **(** :ref:`int<class_int>` ping_interval **)**
  259. Sets the ``ping_interval`` in milliseconds at which pings will be sent to a peer. Pings are used both to monitor the liveness of the connection and also to dynamically adjust the throttle during periods of low traffic so that the throttle has reasonable responsiveness during traffic spikes. The default ping interval is ``500`` milliseconds.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_ENetPacketPeer_method_reset:
  263. .. rst-class:: classref-method
  264. void **reset** **(** **)**
  265. Forcefully disconnects a peer. The foreign host represented by the peer is not notified of the disconnection and will timeout on its connection to the local host.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_ENetPacketPeer_method_send:
  269. .. rst-class:: classref-method
  270. :ref:`Error<enum_@GlobalScope_Error>` **send** **(** :ref:`int<class_int>` channel, :ref:`PackedByteArray<class_PackedByteArray>` packet, :ref:`int<class_int>` flags **)**
  271. Queues a ``packet`` to be sent over the specified ``channel``. See ``FLAG_*`` constants for available packet flags.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_ENetPacketPeer_method_set_timeout:
  275. .. rst-class:: classref-method
  276. void **set_timeout** **(** :ref:`int<class_int>` timeout, :ref:`int<class_int>` timeout_min, :ref:`int<class_int>` timeout_max **)**
  277. Sets the timeout parameters for a peer. The timeout parameters control how and when a peer will timeout from a failure to acknowledge reliable traffic. Timeout values are expressed in milliseconds.
  278. The ``timeout`` is a factor that, multiplied by a value based on the average round trip time, will determine the timeout limit for a reliable packet. When that limit is reached, the timeout will be doubled, and the peer will be disconnected if that limit has reached ``timeout_min``. The ``timeout_max`` parameter, on the other hand, defines a fixed timeout for which any packet must be acknowledged or the peer will be dropped.
  279. .. rst-class:: classref-item-separator
  280. ----
  281. .. _class_ENetPacketPeer_method_throttle_configure:
  282. .. rst-class:: classref-method
  283. void **throttle_configure** **(** :ref:`int<class_int>` interval, :ref:`int<class_int>` acceleration, :ref:`int<class_int>` deceleration **)**
  284. Configures throttle parameter for a peer.
  285. Unreliable packets are dropped by ENet in response to the varying conditions of the Internet connection to the peer. The throttle represents a probability that an unreliable packet should not be dropped and thus sent by ENet to the peer. By measuring fluctuations in round trip times of reliable packets over the specified ``interval``, ENet will either increase the probability by the amount specified in the ``acceleration`` parameter, or decrease it by the amount specified in the ``deceleration`` parameter (both are ratios to :ref:`PACKET_THROTTLE_SCALE<class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE>`).
  286. When the throttle has a value of :ref:`PACKET_THROTTLE_SCALE<class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE>`, no unreliable packets are dropped by ENet, and so 100% of all unreliable packets will be sent.
  287. When the throttle has a value of ``0``, all unreliable packets are dropped by ENet, and so 0% of all unreliable packets will be sent.
  288. Intermediate values for the throttle represent intermediate probabilities between 0% and 100% of unreliable packets being sent. The bandwidth limits of the local and foreign hosts are taken into account to determine a sensible limit for the throttle probability above which it should not raise even in the best of conditions.
  289. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  290. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  291. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  292. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  293. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  294. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`