Hi!<div><br></div><div>This might seem like a stupid question, so I apologize in advance if I have misunderstood something. I have used ENet for quite some time now, not paying that much attention to what ports I am using, and everything has worked fine. I am currently investigating how to incorporate NAT punch through using ENet, and one thing came to mind:</div>
<div><br></div><div>Say I have a server and a client. The server creates a host using enet_host_create() and passes in the following address:</div><div><br></div><div><div>ENetAddress address;</div><div>address.host = ENET_HOST_ANY;</div>
<div>address.port = 1234;</div></div><div><br></div><div>Okay, so now I can create a client on the other end and connect to the server using its IP address and port 1234. When the server receives the data, it prints it to the console along with the IP and port of the sender. Up until this point I have always assumed that the port of the client would also be 1234, but this does not seem to be that case. The port changes every time I connect to the server.</div>
<div><br></div><div>This might not be something that prevents me from doing NAT punch through (though it just as well might, I have not yet done it), but I would like to understand how the system chooses the port for the client, and if there is a way to specify the port to be used. Also, is there any reason I would want to specify the port, or is it better to allow the system to choose it for me?</div>
<div><br></div><div>Thank you!</div><div><br></div><div>//Sebastian Ahlman</div>