2021-06-14 17:51:53 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 21:18:53 +08:00
<class name= "ENetConnection" inherits= "RefCounted" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2021-06-14 17:51:53 +08:00
<brief_description >
A wrapper class for an [url=http://enet.bespin.org/group__host.html]ENetHost[/url].
</brief_description>
<description >
ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol).
</description>
<tutorials >
<link title= "API documentation on the ENet website" > http://enet.bespin.org/usergroup0.html</link>
</tutorials>
<methods >
<method name= "bandwidth_limit" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "in_bandwidth" type= "int" default= "0" />
<param index= "1" name= "out_bandwidth" type= "int" default= "0" />
2021-06-14 17:51:53 +08:00
<description >
Adjusts the bandwidth limits of a host.
</description>
</method>
<method name= "broadcast" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "channel" type= "int" />
<param index= "1" name= "packet" type= "PackedByteArray" />
<param index= "2" name= "flags" type= "int" />
2021-06-14 17:51:53 +08:00
<description >
Queues a [code]packet[/code] to be sent to all peers associated with the host over the specified [code]channel[/code]. See [ENetPacketPeer] [code]FLAG_*[/code] constants for available packet flags.
</description>
</method>
<method name= "channel_limit" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "limit" type= "int" />
2021-06-14 17:51:53 +08:00
<description >
Limits the maximum allowed channels of future incoming connections.
</description>
</method>
<method name= "compress" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "mode" type= "int" enum= "ENetConnection.CompressionMode" />
2021-06-14 17:51:53 +08:00
<description >
Sets the compression method used for network packets. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all.
[b]Note:[/b] Most games' network design involve sending many small packets frequently (smaller than 4 KB each). If in doubt, it is recommended to keep the default compression algorithm as it works best on these small packets.
2021-08-23 23:06:46 +08:00
[b]Note:[/b] The compression mode must be set to the same value on both the server and all its clients. Clients will fail to connect if the compression mode set on the client differs from the one set on the server.
2021-06-14 17:51:53 +08:00
</description>
</method>
<method name= "connect_to_host" >
2021-07-30 21:28:05 +08:00
<return type= "ENetPacketPeer" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "address" type= "String" />
<param index= "1" name= "port" type= "int" />
<param index= "2" name= "channels" type= "int" default= "0" />
<param index= "3" name= "data" type= "int" default= "0" />
2021-06-14 17:51:53 +08:00
<description >
Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 14:03:58 +08:00
Initiates a connection to a foreign [code]address[/code] using the specified [code]port[/code] and allocating the requested [code]channels[/code]. Optional [code]data[/code] can be passed during connection in the form of a 32 bit integer.
2021-10-05 20:24:34 +08:00
[b]Note:[/b] You must call either [method create_host] or [method create_host_bound] before calling this method.
2021-06-14 17:51:53 +08:00
</description>
</method>
<method name= "create_host" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Error" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "max_peers" type= "int" default= "32" />
<param index= "1" name= "max_channels" type= "int" default= "0" />
<param index= "2" name= "in_bandwidth" type= "int" default= "0" />
<param index= "3" name= "out_bandwidth" type= "int" default= "0" />
2021-06-14 17:51:53 +08:00
<description >
Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 14:03:58 +08:00
Create an ENetHost that will allow up to [code]max_peers[/code] connected peers, each allocating up to [code]max_channels[/code] channels, optionally limiting bandwidth to [code]in_bandwidth[/code] and [code]out_bandwidth[/code].
2021-06-14 17:51:53 +08:00
</description>
</method>
<method name= "create_host_bound" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Error" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "bind_address" type= "String" />
<param index= "1" name= "bind_port" type= "int" />
<param index= "2" name= "max_peers" type= "int" default= "32" />
<param index= "3" name= "max_channels" type= "int" default= "0" />
<param index= "4" name= "in_bandwidth" type= "int" default= "0" />
<param index= "5" name= "out_bandwidth" type= "int" default= "0" />
2021-06-14 17:51:53 +08:00
<description >
Create an ENetHost like [method create_host] which is also bound to the given [code]bind_address[/code] and [code]bind_port[/code].
</description>
</method>
<method name= "destroy" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2021-06-14 17:51:53 +08:00
<description >
Destroys the host and all resources associated with it.
</description>
</method>
<method name= "dtls_client_setup" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Error" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "certificate" type= "X509Certificate" />
<param index= "1" name= "hostname" type= "String" />
<param index= "2" name= "verify" type= "bool" default= "true" />
2021-06-14 17:51:53 +08:00
<description >
Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet clients. Call this before [method connect_to_host] to have ENet connect using DTLS with [code]certificate[/code] and [code]hostname[/code] verification. Verification can be optionally turned off via the [code]verify[/code] parameter.
</description>
</method>
<method name= "dtls_server_setup" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Error" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "key" type= "CryptoKey" />
<param index= "1" name= "certificate" type= "X509Certificate" />
2021-06-14 17:51:53 +08:00
<description >
Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet servers. Call this right after [method create_host_bound] to have ENet expect peers to connect using DTLS.
</description>
</method>
<method name= "flush" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2021-06-14 17:51:53 +08:00
<description >
Sends any queued packets on the host specified to its designated peers.
</description>
</method>
<method name= "get_local_port" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2021-06-14 17:51:53 +08:00
<description >
Returns the local port to which this peer is bound.
</description>
</method>
<method name= "get_max_channels" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2021-06-14 17:51:53 +08:00
<description >
Returns the maximum number of channels allowed for connected peers.
</description>
</method>
<method name= "get_peers" >
2022-08-08 06:52:20 +08:00
<return type= "ENetPacketPeer[]" />
2021-06-14 17:51:53 +08:00
<description >
Returns the list of peers associated with this host.
2021-10-05 20:24:34 +08:00
[b]Note:[/b] This list might include some peers that are not fully connected or are still being disconnected.
2021-06-14 17:51:53 +08:00
</description>
</method>
<method name= "pop_statistic" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "statistic" type= "int" enum= "ENetConnection.HostStatistic" />
2021-06-14 17:51:53 +08:00
<description >
Returns and resets host statistics. See [enum HostStatistic] for more info.
</description>
</method>
<method name= "refuse_new_connections" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "refuse" type= "bool" />
2021-06-14 17:51:53 +08:00
<description >
Configures the DTLS server to automatically drop new connections.
2021-10-05 20:24:34 +08:00
[b]Note:[/b] This method is only relevant after calling [method dtls_server_setup].
2021-06-14 17:51:53 +08:00
</description>
</method>
<method name= "service" >
2021-07-30 21:28:05 +08:00
<return type= "Array" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "timeout" type= "int" default= "0" />
2021-06-14 17:51:53 +08:00
<description >
Waits for events on the host specified and shuttles packets between the host and its peers. The returned [Array] will have 4 elements. An [enum EventType], the [ENetPacketPeer] which generated the event, the event associated data (if any), the event associated channel (if any). If the generated event is [constant EVENT_RECEIVE], the received packet will be queued to the associated [ENetPacketPeer].
Call this function regularly to handle connections, disconnections, and to receive new packets.
</description>
</method>
</methods>
<constants >
<constant name= "COMPRESS_NONE" value= "0" enum= "CompressionMode" >
No compression. This uses the most bandwidth, but has the upside of requiring the fewest CPU resources. This option may also be used to make network debugging using tools like Wireshark easier.
</constant>
<constant name= "COMPRESS_RANGE_CODER" value= "1" enum= "CompressionMode" >
ENet's built-in range encoding. Works well on small packets, but is not the most efficient algorithm on packets larger than 4 KB.
</constant>
<constant name= "COMPRESS_FASTLZ" value= "2" enum= "CompressionMode" >
2021-08-22 09:56:25 +08:00
[url=https://fastlz.org/]FastLZ[/url] compression. This option uses less CPU resources compared to [constant COMPRESS_ZLIB], at the expense of using more bandwidth.
2021-06-14 17:51:53 +08:00
</constant>
<constant name= "COMPRESS_ZLIB" value= "3" enum= "CompressionMode" >
[url=https://www.zlib.net/]Zlib[/url] compression. This option uses less bandwidth compared to [constant COMPRESS_FASTLZ], at the expense of using more CPU resources.
</constant>
<constant name= "COMPRESS_ZSTD" value= "4" enum= "CompressionMode" >
[url=https://facebook.github.io/zstd/]Zstandard[/url] compression. Note that this algorithm is not very efficient on packets smaller than 4 KB. Therefore, it's recommended to use other compression algorithms in most cases.
</constant>
<constant name= "EVENT_ERROR" value= "-1" enum= "EventType" >
An error occurred during [method service]. You will likely need to [method destroy] the host and recreate it.
</constant>
<constant name= "EVENT_NONE" value= "0" enum= "EventType" >
No event occurred within the specified time limit.
</constant>
<constant name= "EVENT_CONNECT" value= "1" enum= "EventType" >
A connection request initiated by enet_host_connect has completed. The array will contain the peer which successfully connected.
</constant>
<constant name= "EVENT_DISCONNECT" value= "2" enum= "EventType" >
Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 14:03:58 +08:00
A peer has disconnected. This event is generated on a successful completion of a disconnect initiated by [method ENetPacketPeer.peer_disconnect], if a peer has timed out, or if a connection request initialized by [method connect_to_host] has timed out. The array will contain the peer which disconnected. The data field contains user supplied data describing the disconnection, or 0, if none is available.
2021-06-14 17:51:53 +08:00
</constant>
<constant name= "EVENT_RECEIVE" value= "3" enum= "EventType" >
A packet has been received from a peer. The array will contain the peer which sent the packet, the channel number upon which the packet was received, and the received packet.
</constant>
<constant name= "HOST_TOTAL_SENT_DATA" value= "0" enum= "HostStatistic" >
Total data sent.
</constant>
<constant name= "HOST_TOTAL_SENT_PACKETS" value= "1" enum= "HostStatistic" >
Total UDP packets sent.
</constant>
<constant name= "HOST_TOTAL_RECEIVED_DATA" value= "2" enum= "HostStatistic" >
Total data received.
</constant>
<constant name= "HOST_TOTAL_RECEIVED_PACKETS" value= "3" enum= "HostStatistic" >
Total UDP packets received.
</constant>
</constants>
</class>