SFML community forums

Help => Network => Topic started by: zac on January 18, 2009, 03:55:06 pm

Title: Alternative to whatismyip.org
Post by: zac on January 18, 2009, 03:55:06 pm
Looking for an alternative to whatismyip.org (which is not reachable, at least from here)...
Code: [Select]

     sf::IPAddress __getIpFromCheckipdyndns_org()
    {
IPAddress PublicAddress;

Http Server("http://checkip.dyndns.org");
Http::Request Request(Http::Request::Get, "/");
Http::Response Page = Server.SendRequest(Request,4.f);

if(Page.GetStatus() == Http::Response::Ok)
{
string s = Page.GetBody();
size_t ind = s.find_first_of("0123456789");
if(ind != string::npos)
{
size_t indl = s.find_first_not_of("0123456789.",ind);
string sub = s.substr(ind,indl-ind);
if(sub.length() >= 7 && sub.length() <= 15)
{
PublicAddress = sub;
}
}
}
return PublicAddress;
}


Any idea why it is not working (the page is reachable in my Browser), but immediately returning an empty page??
Title: Alternative to whatismyip.org
Post by: Laurent on January 18, 2009, 07:02:23 pm
Your code works perfectly on my machine.
Title: Alternative to whatismyip.org
Post by: Core Xii on January 18, 2009, 11:26:10 pm
http://www.dyndns.com/developers/checkip.html

Quote
Checks must be spaced 10 minutes apart to help reduce server load

Sure you conformed to this?
Title: Alternative to whatismyip.org
Post by: zac on January 20, 2009, 07:08:29 pm
Thats not that good... ;)
Okay. It is no possible alternative, I think ;)

We have to find another way - whatismyip.org still does not respond. (It least I get stuck on creating a connection).
Title: Alternative to whatismyip.org
Post by: Core Xii on January 20, 2009, 11:02:25 pm
Finding your IP is as simple as connecting to any host that is configured to reply with your remote IP. It's easy to set up your own host to do this, the only requirement is a static IP or DNS so the clients know where to connect.

For instance if you have a web server with PHP, it's as easy as
Code: [Select]
<?php echo $_SERVER['REMOTE_ADDR'&#93;; ?>

In fact, I just did that in 3 minutes: http://corexii.com/ip/

You can use that for development if you can't make your own; However, do not use it for a public distribution, I don't know if I can cope with the traffic.
Title: Alternative to whatismyip.org
Post by: Laurent on January 20, 2009, 11:35:45 pm
The server www.whatismyip.org is currently unreachable, and it is indeed very simple to make a webpage return an IP address, so I added one on the SFML website and added it as a fallback in IPAddress::GetPublicAddress :)
Title: Alternative to whatismyip.org
Post by: zac on January 20, 2009, 11:39:18 pm
Okay, great :).
Title: Alternative to whatismyip.org
Post by: dewyatt on January 25, 2009, 10:57:15 am
I just thought I'd add another alternative in case anyone needs one:
http://www.showmyip.com/simple
Title: Alternative to whatismyip.org
Post by: Daazku on January 25, 2009, 04:29:44 pm
www.whatismyip.com is the one i always go... he is table since many year...

http://whatismyip.com/automation/n09230945.asp