enet.host (Français)
Description
Un hôte ENet poru communiquer avec des pairs. À sa création, il écoutera sur un port et à une adresse, à moins qu'ils ne soient spécifiés, qui évitera aux autres applications d'utiliser les mêmes ports et adresse.
Il est possible de libérer le port en appelant son destructeur ; Mettre l'objet host (hôte) à nil (nul) et appeler collectgarbage() devrait également fonctionner, puisque :destroy appelle host:__gc en interne, mais la procédure qui suit est plus propre :
local host = enet.host_create("*:6789")
host:destroy()
Fonctions
Function | Description |
---|---|
host:service | Wait for events, send and receive any ready packets. |
host:check_events | Checks for any queued events and dispatches one if available. |
host:compress_with_range_coder | Toggles an adaptive order-2 PPM range coder for the transmitted data of all peers. |
host:connect | Connects a host to a remote host. Returns peer object associated with remote host. |
host:flush | Sends any queued packets. |
host:broadcast | Queues a packet to be sent to all connected peers. |
host:channel_limit | Sets the maximum number of channels allowed. |
host:bandwidth_limit | Sets the bandwidth limits of the host in bytes/sec. |
host:get_socket_address | Returns a string that describes the socket address of the given host. |
host:socket_get_address | Deprecated version of host:get_socket_address. |
host:destroy | Destroys the host, freeing any bound ports and addresses. Alias for the host:__gc method. |
host:total_sent_data | Returns the number of bytes that were sent through the given host. |
host:total_received_data | Returns the number of bytes that were received by the given host. |
host:service_time | Returns the timestamp of the last call to host:service() or host:flush(). |
host:peer_count | Returns the number of peers that are allocated for the given host. |
host:get_peer | Returns the connected peer at the specified index (starting at 1). |
host:__gc | Destroys the host, freeing any bound ports and addresses. |
Voir également
Autres langues
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info