<div dir="ltr">Hello,<div><br></div><div>I have a question about multiple local addresses and detecting which one is the one for the network enet is using.</div><div><br></div><div>I am writing a game where you create an enet host which acts as the server, and other players connect to the server as clients. I implemented basic NAT punch through for the system which works fairly well. However, for some setups I cannot seem to connect two computers to each other if they are in the same local network. Because of this, I send the local address of each computer along with the public address used for the punch through. If the two hosts cannot reach each other after some time, they switch to using their local addresses and usually that works fine.</div>
<div><br></div><div>To get local address of the machine I call gethostname() to get the name and then gethostbyname() to get the hostent struct for the local machine. The struct has a list of all the addresses for the machine.</div>
<div><br></div><div>The problem is that sometimes there are multiple addresses. For example, installing the Windows 8 SDK creates a virtual network for Windows Phone 8 development. Passing this address as the local address obviously wont work. So the question is, given a number of addresses, how do I determine which one is the one which other computers can use to reach the enet host of this machine?</div>
<div><br></div><div>PS: my hosts are created like so:</div><div><br></div><div><div>ENetAddress addr;</div><div>addr.host = ENET_HOST_ANY;</div><div>addr.port = portNumber;</div></div><div><br></div><div>Ie. the port is known, the address is not (?).</div>
<div><br></div><div>Thanks!</div><div><br></div><div><br></div></div>