1
Network / Getting an IP address
« on: April 17, 2008, 12:34:10 pm »
Laurent, I meant that you could get the IP from the network interface, like you do in IPAddress::GetLocalAddress(), instead of loading a webpage and parsing the HTML.
You would know if the computer is behind a router or firewall if the address you get is in the range of local addresses:
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
169.254.0.0 - 169.254.255.255
Only then would you resort to the webpage method. And even so, although I don't have an alternative to give you right now, my experience tells me it is a very bad idea to rely on a website (especially being just one website) to get this information. But I don't think anyone would dispute that.
As for the local address, you're right, I'm sorry, I don't know why but it looked like you were also doing stuff that seemed unnecessary to me. Forget about that, then.
Daazku, perhaps you should google "how to behave on a forum" before posting such a thing.
Or you could just look into the possibility that when someone says something which doesn't agree with what you think, it can actually make sense, and listen to what that person has to say before calling him/her stupid in an indirect way. But that's just me talking...
You would know if the computer is behind a router or firewall if the address you get is in the range of local addresses:
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
169.254.0.0 - 169.254.255.255
Only then would you resort to the webpage method. And even so, although I don't have an alternative to give you right now, my experience tells me it is a very bad idea to rely on a website (especially being just one website) to get this information. But I don't think anyone would dispute that.
As for the local address, you're right, I'm sorry, I don't know why but it looked like you were also doing stuff that seemed unnecessary to me. Forget about that, then.
Daazku, perhaps you should google "how to behave on a forum" before posting such a thing.
Or you could just look into the possibility that when someone says something which doesn't agree with what you think, it can actually make sense, and listen to what that person has to say before calling him/her stupid in an indirect way. But that's just me talking...