mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
554 lines
28 KiB
ReStructuredText
554 lines
28 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_ENetPacketPeer:
|
||
|
||
ENetPacketPeer
|
||
==============
|
||
|
||
**Hérite de :** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
Une classe wrapper pour un `ENetPeer <http://enet.bespin.org/group__peer.html>`__.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Description
|
||
-----------
|
||
|
||
Une implémentation de PacketPeer représentant un pair d'une :ref:`ENetConnection<class_ENetConnection>`.
|
||
|
||
Cette classe ne peut pas être instanciée directement mais peut être récupérée pendant :ref:`ENetConnection.service()<class_ENetConnection_method_service>` ou via :ref:`ENetConnection.get_peers()<class_ENetConnection_method_get_peers>`.
|
||
|
||
\ **Note :** Lors de l'export vers Android, assurez-vous d'activer la permission ``INTERNET`` dans le préréglage d'export Android avant d'exporter le projet ou en utilisant le déploiement en un clic. Sinon, la communication réseau de tout type sera bloquée par Android.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Tutoriels
|
||
------------------
|
||
|
||
- `Documentation de l'API sur le site web d'ENet <http://enet.bespin.org/usergroup0.html>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Méthodes
|
||
----------------
|
||
|
||
.. 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
|
||
|
||
Énumérations
|
||
------------------------
|
||
|
||
.. _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``
|
||
|
||
Le pair est déconnecté.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_CONNECTING:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTING** = ``1``
|
||
|
||
Le pair est en train d'essayer de se connecter.
|
||
|
||
.. _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``
|
||
|
||
Le pair est actuellement en train de se connecter.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_CONNECTION_SUCCEEDED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_CONNECTION_SUCCEEDED** = ``4``
|
||
|
||
Le pair a réussi à se connecter, mais n'est pas prêt à être communiqué avec (: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``
|
||
|
||
Le pair est actuellement connecté et prêt à être communiqué avec.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_DISCONNECT_LATER:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECT_LATER** = ``6``
|
||
|
||
Le pair devrait se déconnecter après qu'il n'ait plus de paquets sortants à envoyer.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_DISCONNECTING:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_DISCONNECTING** = ``7``
|
||
|
||
Le pair est en cours de déconnexion.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_ACKNOWLEDGING_DISCONNECT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ACKNOWLEDGING_DISCONNECT** = ``8``
|
||
|
||
Le pair a reconnu la demande de déconnexion.
|
||
|
||
.. _class_ENetPacketPeer_constant_STATE_ZOMBIE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`PeerState<enum_ENetPacketPeer_PeerState>` **STATE_ZOMBIE** = ``9``
|
||
|
||
Le pair a perdu la connexion, mais n'est pas considéré comme vraiment déconnecté (car le pair n'a pas reconnu la demande de déconnexion).
|
||
|
||
.. 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``
|
||
|
||
Variance de paquets perdus.
|
||
|
||
.. _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
|
||
|
||
Constantes
|
||
--------------------
|
||
|
||
.. _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
|
||
|
||
Descriptions des méthodes
|
||
--------------------------------------------------
|
||
|
||
.. _class_ENetPacketPeer_method_get_channels:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_channels**\ (\ ) |const| :ref:`🔗<class_ENetPacketPeer_method_get_channels>`
|
||
|
||
Renvoie le nombre de canaux alloués à la communication avec le pair.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie les drapeaux ENet du prochain paquet dans la file reçue. Voir les constantes ``FLAG_*`` pour les drapeaux de paquet disponibles. Notez que les drapeaux ne sont pas tous répliqués entre le pair émetteur et le pair récepteur.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie l'adresse IP de ce pair.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie le port distant de ce pair.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie l'état actuel du pair.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie la statistique ``statistic`` demandée pour ce pair.
|
||
|
||
.. 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>`
|
||
|
||
Renvoie ``true`` si le pair est actuellement actif (c.-à-d. que le :ref:`ENetConnection<class_ENetConnection>` associé est toujours valide).
|
||
|
||
.. 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>`
|
||
|
||
Demande une déconnexion d'un pair. Un évènement :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` sera généré pendant :ref:`ENetConnection.service()<class_ENetConnection_method_service>` une fois la déconnexion terminée.
|
||
|
||
.. 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>`
|
||
|
||
Demande une déconnexion d'un pair, mais seulement après que tous les paquets en cours d'attente soient envoyés. Un évènement :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` sera généré pendant :ref:`ENetConnection.service()<class_ENetConnection_method_service>` une fois la déconnexion terminée.
|
||
|
||
.. 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 une déconnexion immédiate d'un pair. Aucun évènement :ref:`ENetConnection.EVENT_DISCONNECT<class_ENetConnection_constant_EVENT_DISCONNECT>` ne sera généré. Le pair étranger n'est pas garanti de recevoir la notification de déconnexion et est réinitialisé immédiatement après le renvoi de cette fonction.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ENetPacketPeer_method_ping:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **ping**\ (\ ) :ref:`🔗<class_ENetPacketPeer_method_ping>`
|
||
|
||
Envoye une requête de ping à un pair. ENet ping automatiquement tous les pairs connectés à intervalles réguliers, cependant, cette fonction peut être appelée pour assurer des requêtes de ping plus fréquentes.
|
||
|
||
.. 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>`
|
||
|
||
Force la déconnexion d'un pair. L'hôte étranger représenté par le pair n'est pas averti de la déconnexion et fera un timeout sur sa connexion à l'hôte local.
|
||
|
||
.. 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 (Cette méthode doit typiquement être redéfinie par l'utilisateur pour avoir un effet.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Cette méthode n'a pas d'effets de bord. Elle ne modifie aucune des variables membres de l'instance.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Cette méthode accepte n'importe quel nombre d'arguments après ceux décris ici.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Cette méthode est utilisée pour construire un type.)`
|
||
.. |static| replace:: :abbr:`static (Cette méthode n'a pas besoin d'instance pour être appelée, elle peut donc être directement appelée en utilisant le nom de la classe.)`
|
||
.. |operator| replace:: :abbr:`operator (Cette méthode décrit un opérateur valide à utiliser avec ce type en tant qu'opérande gauche.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Cette valeur est un nombre entier composé d'un masque de bits des options suivantes.)`
|
||
.. |void| replace:: :abbr:`void (Aucune valeur de retour.)`
|