Closed Nhlest closed 11 months ago
You can bind the socket to 0.0.0.0
(all interfaces). But 0.0.0.0
is not a valid destination to send packets to. You can check that here.
So you would need to use the public address for the server set to 127.0.0.1
(loopback), 192.168.0.x
(local network), or your computer's IP.
For the computer IP you need to do some setup because you are probably behind a NAT, and would need to port forward. Or you can use a signaling server (what WebRTC does) to punch-through the NAT.
Well yeah, i understand all of that reasoning. So there is no way to automatically bind it to a correct IP address (because even 0.0.0.0 doesnt always work) and i always have to manually specify my external IP address as a command line argument.
Well yeah, i understand all of that reasoning. So there is no way to automatically bind it to a correct IP address (because even 0.0.0.0 doesnt always work) and i always have to manually specify my external IP address as a command line argument.
Yes, you need to specify the address somehow, if you bind an UdpSocket using 0.0.0.0
you will need to get the address manually.
With #102 the host check will be skipped in unsecure connections, so it will be easier to test.
All examples / usages use
127.0.0.1
which makes server only listen on loopback interface. Using0.0.0.0
doesn't work as well for some weird reason related to UDP protocol itself (something to do with it being unable to tell which interface to reply on). So is there a solution to that problem without hardcoding / passing actual WAN IP address directly?