Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - borfast

Pages: [1]
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...

2
Network / Getting an IP address
« on: April 12, 2008, 03:53:46 am »
Hello.

I was looking at the network tutorial and I read something I think is incorrect:

Quote
Please note that GetPublicAddress() is very slow : the only way to get a public address is to get it from the outside (especially when you are behind a proxy or a firewall), so it connects to an external website (www.whatismyip.org) and parse the returned web page to extract the public IP address. So, don't use it too much.


Please, don't get me wrong, I'm not trying to bash you or diminish the value of your work with SFML but I don't think this is the case at all. You are going through a lot of unnecessary work when you could just grab the IP address from the public interface.

In the case the computer is behind a proxy/firewall (a very common setup, nowadays, with the advent of broadband home routers/gateways), then you would need something like what you have implemented but otherwise, grabbing the IP address of the public interface is all that is necessary - there's no need to go to a public website to get it.

I've glanced at the network code and from what I can tell, even for the local address you are jumping through loops when all you need is to get an address from an interface.

Is there a reason why you did it this way?

Pages: [1]
anything