123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/modules/enet/doc_classes/ENetPacketPeer.xml.
- .. _class_ENetPacketPeer:
- ENetPacketPeer
- ==============
- **Inherits:** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A wrapper class for an `ENetPeer <http://enet.bespin.org/group__peer.html>`__.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- A PacketPeer implementation representing a peer of an :ref:`ENetConnection<class_ENetConnection>`.
- 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>`.
- \ **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.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - `API documentation on the ENet website <http://enet.bespin.org/usergroup0.html>`__
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_channels<class_ENetPacketPeer_method_get_channels>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_packet_flags<class_ENetPacketPeer_method_get_packet_flags>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_remote_address<class_ENetPacketPeer_method_get_remote_address>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_remote_port<class_ENetPacketPeer_method_get_remote_port>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PeerState<enum_ENetPacketPeer_PeerState>` | :ref:`get_state<class_ENetPacketPeer_method_get_state>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_statistic<class_ENetPacketPeer_method_get_statistic>`\ (\ statistic\: :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>`\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_active<class_ENetPacketPeer_method_is_active>`\ (\ ) |const| |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`peer_disconnect<class_ENetPacketPeer_method_peer_disconnect>`\ (\ data\: :ref:`int<class_int>` = 0\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`peer_disconnect_later<class_ENetPacketPeer_method_peer_disconnect_later>`\ (\ data\: :ref:`int<class_int>` = 0\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`peer_disconnect_now<class_ENetPacketPeer_method_peer_disconnect_now>`\ (\ data\: :ref:`int<class_int>` = 0\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`ping<class_ENetPacketPeer_method_ping>`\ (\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`ping_interval<class_ENetPacketPeer_method_ping_interval>`\ (\ ping_interval\: :ref:`int<class_int>`\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`reset<class_ENetPacketPeer_method_reset>`\ (\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`send<class_ENetPacketPeer_method_send>`\ (\ channel\: :ref:`int<class_int>`, packet\: :ref:`PackedByteArray<class_PackedByteArray>`, flags\: :ref:`int<class_int>`\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_timeout<class_ENetPacketPeer_method_set_timeout>`\ (\ timeout\: :ref:`int<class_int>`, timeout_min\: :ref:`int<class_int>`, timeout_max\: :ref:`int<class_int>`\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`throttle_configure<class_ENetPacketPeer_method_throttle_configure>`\ (\ interval\: :ref:`int<class_int>`, acceleration\: :ref:`int<class_int>`, deceleration\: :ref:`int<class_int>`\ ) |
- +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_ENetPacketPeer_PeerState:
- .. rst-class:: classref-enumeration
- enum **PeerState**: :ref:`🔗<enum_ENetPacketPeer_PeerState>`
- .. _class_ENetPacketPeer_constant_STATE_DISCONNECTED:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECTED** = ``0``
- The peer is disconnected.
- .. _class_ENetPacketPeer_constant_STATE_CONNECTING:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTING** = ``1``
- The peer is currently attempting to connect.
- .. _class_ENetPacketPeer_constant_STATE_ACKNOWLEDGING_CONNECT:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ACKNOWLEDGING_CONNECT** = ``2``
- The peer has acknowledged the connection request.
- .. _class_ENetPacketPeer_constant_STATE_CONNECTION_PENDING:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTION_PENDING** = ``3``
- The peer is currently connecting.
- .. _class_ENetPacketPeer_constant_STATE_CONNECTION_SUCCEEDED:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTION_SUCCEEDED** = ``4``
- The peer has successfully connected, but is not ready to communicate with yet (:ref:`STATE_CONNECTED<class_ENetPacketPeer_constant_STATE_CONNECTED>`).
- .. _class_ENetPacketPeer_constant_STATE_CONNECTED:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTED** = ``5``
- The peer is currently connected and ready to communicate with.
- .. _class_ENetPacketPeer_constant_STATE_DISCONNECT_LATER:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECT_LATER** = ``6``
- The peer is slated to disconnect after it has no more outgoing packets to send.
- .. _class_ENetPacketPeer_constant_STATE_DISCONNECTING:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECTING** = ``7``
- The peer is currently disconnecting.
- .. _class_ENetPacketPeer_constant_STATE_ACKNOWLEDGING_DISCONNECT:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ACKNOWLEDGING_DISCONNECT** = ``8``
- The peer has acknowledged the disconnection request.
- .. _class_ENetPacketPeer_constant_STATE_ZOMBIE:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ZOMBIE** = ``9``
- The peer has lost connection, but is not considered truly disconnected (as the peer didn't acknowledge the disconnection request).
- .. rst-class:: classref-item-separator
- ----
- .. _enum_ENetPacketPeer_PeerStatistic:
- .. rst-class:: classref-enumeration
- enum **PeerStatistic**: :ref:`🔗<enum_ENetPacketPeer_PeerStatistic>`
- .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS** = ``0``
- Mean packet loss of reliable packets as a ratio with respect to the :ref:`PACKET_LOSS_SCALE<class_ENetPacketPeer_constant_PACKET_LOSS_SCALE>`.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS_VARIANCE:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS_VARIANCE** = ``1``
- Packet loss variance.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_LOSS_EPOCH:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_LOSS_EPOCH** = ``2``
- 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.
- .. _class_ENetPacketPeer_constant_PEER_ROUND_TRIP_TIME:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_ROUND_TRIP_TIME** = ``3``
- Mean packet round trip time for reliable packets.
- .. _class_ENetPacketPeer_constant_PEER_ROUND_TRIP_TIME_VARIANCE:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_ROUND_TRIP_TIME_VARIANCE** = ``4``
- Variance of the mean round trip time.
- .. _class_ENetPacketPeer_constant_PEER_LAST_ROUND_TRIP_TIME:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_LAST_ROUND_TRIP_TIME** = ``5``
- Last recorded round trip time for a reliable packet.
- .. _class_ENetPacketPeer_constant_PEER_LAST_ROUND_TRIP_TIME_VARIANCE:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_LAST_ROUND_TRIP_TIME_VARIANCE** = ``6``
- Variance of the last trip time recorded.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE** = ``7``
- The peer's current throttle status.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_LIMIT:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_LIMIT** = ``8``
- 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>`.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_COUNTER:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_COUNTER** = ``9``
- 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.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_EPOCH:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_EPOCH** = ``10``
- 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>`.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_ACCELERATION:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_ACCELERATION** = ``11``
- 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``.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_DECELERATION:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_DECELERATION** = ``12``
- 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``.
- .. _class_ENetPacketPeer_constant_PEER_PACKET_THROTTLE_INTERVAL:
- .. rst-class:: classref-enumeration-constant
- :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>` **PEER_PACKET_THROTTLE_INTERVAL** = ``13``
- 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``.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Constants
- ---------
- .. _class_ENetPacketPeer_constant_PACKET_LOSS_SCALE:
- .. rst-class:: classref-constant
- **PACKET_LOSS_SCALE** = ``65536`` :ref:`🔗<class_ENetPacketPeer_constant_PACKET_LOSS_SCALE>`
- 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>`.
- .. _class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE:
- .. rst-class:: classref-constant
- **PACKET_THROTTLE_SCALE** = ``32`` :ref:`🔗<class_ENetPacketPeer_constant_PACKET_THROTTLE_SCALE>`
- The reference value for throttle configuration. The default value is ``32``. See :ref:`throttle_configure<class_ENetPacketPeer_method_throttle_configure>`.
- .. _class_ENetPacketPeer_constant_FLAG_RELIABLE:
- .. rst-class:: classref-constant
- **FLAG_RELIABLE** = ``1`` :ref:`🔗<class_ENetPacketPeer_constant_FLAG_RELIABLE>`
- Mark the packet to be sent as reliable.
- .. _class_ENetPacketPeer_constant_FLAG_UNSEQUENCED:
- .. rst-class:: classref-constant
- **FLAG_UNSEQUENCED** = ``2`` :ref:`🔗<class_ENetPacketPeer_constant_FLAG_UNSEQUENCED>`
- Mark the packet to be sent unsequenced (unreliable).
- .. _class_ENetPacketPeer_constant_FLAG_UNRELIABLE_FRAGMENT:
- .. rst-class:: classref-constant
- **FLAG_UNRELIABLE_FRAGMENT** = ``8`` :ref:`🔗<class_ENetPacketPeer_constant_FLAG_UNRELIABLE_FRAGMENT>`
- Mark the packet to be sent unreliable even if the packet is too big and needs fragmentation (increasing the chance of it being dropped).
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_ENetPacketPeer_method_get_channels:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_channels**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_channels>`
- Returns the number of channels allocated for communication with peer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_get_packet_flags:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_packet_flags**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_packet_flags>`
- Returns the ENet flags of the next packet in the received queue. See ``FLAG_*`` constants for available packet flags. Note that not all flags are replicated from the sending peer to the receiving peer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_get_remote_address:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_remote_address**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_remote_address>`
- Returns the IP address of this peer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_get_remote_port:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_remote_port**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_remote_port>`
- Returns the remote port of this peer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_get_state:
- .. rst-class:: classref-method
- :ref:`PeerState<enum_ENetPacketPeer_PeerState>` **get_state**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_state>`
- Returns the current peer state. See :ref:`PeerState<enum_ENetPacketPeer_PeerState>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_get_statistic:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_statistic**\ (\ statistic\: :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>`\ ) :ref:`🔗<class_ENetPacketPeer_method_get_statistic>`
- Returns the requested ``statistic`` for this peer. See :ref:`PeerStatistic<enum_ENetPacketPeer_PeerStatistic>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_is_active:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_active**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_is_active>`
- Returns ``true`` if the peer is currently active (i.e. the associated :ref:`ENetConnection<class_ENetConnection>` is still valid).
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_peer_disconnect:
- .. rst-class:: classref-method
- |void| **peer_disconnect**\ (\ data\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_ENetPacketPeer_method_peer_disconnect>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_peer_disconnect_later:
- .. rst-class:: classref-method
- |void| **peer_disconnect_later**\ (\ data\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_ENetPacketPeer_method_peer_disconnect_later>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_peer_disconnect_now:
- .. rst-class:: classref-method
- |void| **peer_disconnect_now**\ (\ data\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_ENetPacketPeer_method_peer_disconnect_now>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_ping:
- .. rst-class:: classref-method
- |void| **ping**\ (\ ) :ref:`🔗<class_ENetPacketPeer_method_ping>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_ping_interval:
- .. rst-class:: classref-method
- |void| **ping_interval**\ (\ ping_interval\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ENetPacketPeer_method_ping_interval>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_reset:
- .. rst-class:: classref-method
- |void| **reset**\ (\ ) :ref:`🔗<class_ENetPacketPeer_method_reset>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_send:
- .. rst-class:: classref-method
- :ref:`Error<enum_@GlobalScope_Error>` **send**\ (\ channel\: :ref:`int<class_int>`, packet\: :ref:`PackedByteArray<class_PackedByteArray>`, flags\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ENetPacketPeer_method_send>`
- Queues a ``packet`` to be sent over the specified ``channel``. See ``FLAG_*`` constants for available packet flags.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_set_timeout:
- .. rst-class:: classref-method
- |void| **set_timeout**\ (\ timeout\: :ref:`int<class_int>`, timeout_min\: :ref:`int<class_int>`, timeout_max\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ENetPacketPeer_method_set_timeout>`
- 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.
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ENetPacketPeer_method_throttle_configure:
- .. rst-class:: classref-method
- |void| **throttle_configure**\ (\ interval\: :ref:`int<class_int>`, acceleration\: :ref:`int<class_int>`, deceleration\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ENetPacketPeer_method_throttle_configure>`
- Configures throttle parameter for a peer.
- 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>`).
- 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.
- 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.
- 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.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|