Add method to get bound local address to ENetConnection #112275
+26
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was already a method to get the port but I could not find a way to get the address. I noticed that the wildcard addresses have weird behaviour, not sure if I need to document that or where I would.
According to
sson Linux, when using the built-in ENet using*or::as the bind address will actually bind to*and be accessible over IPv4 and 6, but usingenet_socket_get_addresswill return::. When using0.0.0.0as the bind address,enet_socket_get_addresswill return0.0.0.0but the socket will be bound to::ffff:0.0.0.0and will be accessible over IPv4 normally, but can only be accessed by IPv6 using an IPv4-mapped IPv6 address (e.g.::ffff:7f00:1/::ffff:127.0.0.1).When not using the built-in ENet,
*and0.0.0.0will bind to0.0.0.0andenet_socket_get_addresswill return0.0.0.0.Given that setting
::and*both result in*being bound I chose to always return*. I also chose to leave0.0.0.0because its functionality is actually different from*and::.