Add socket_send method to ENetConnection.
* Sends a given packet toward a given destination address and port, using the current ENetHost's socket.
This commit is contained in:
parent
eb86dabee0
commit
9e2f48c749
3 changed files with 46 additions and 0 deletions
|
|
@ -145,6 +145,17 @@
|
|||
Call this function regularly to handle connections, disconnections, and to receive new packets.
|
||||
</description>
|
||||
</method>
|
||||
<method name="socket_send">
|
||||
<return type="void" />
|
||||
<param index="0" name="destination_address" type="String" />
|
||||
<param index="1" name="destination_port" type="int" />
|
||||
<param index="2" name="packet" type="PackedByteArray" />
|
||||
<description>
|
||||
Sends a [param packet] toward a destination from the address and port currently bound by this ENetConnection instance.
|
||||
This is useful as it serves to establish entries in NAT routing tables on all devices between this bound instance and the public facing internet, allowing a prospective client's connection packets to be routed backward through the NAT device(s) between the public internet and this host.
|
||||
This requires forward knowledge of a prospective client's address and communication port as seen by the public internet - after any NAT devices have handled their connection request. This information can be obtained by a [url=https://en.wikipedia.org/wiki/STUN]STUN[/url] service, and must be handed off to your host by an entity that is not the prospective client. This will never work for a client behind a Symmetric NAT due to the nature of the Symmetric NAT routing algorithm, as their IP and Port cannot be known beforehand.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<constants>
|
||||
<constant name="COMPRESS_NONE" value="0" enum="CompressionMode">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue