IpAddress IpAddress::GetPublicAddress(Time timeout) { // The trick here is more complicated, because the only way // to get our public IP address is to get it from a distant computer. // Here we get the web page from http://www.sfml-dev.org/ip-provider.php // and parse the result to extract our IP address // (not very hard: the web page contains only our IP address). Http server("www.sfml-dev.org"); Http::Request request("/ip-provider.php", Http::Request::Get); Http::Response page = server.SendRequest(request, timeout); if (page.GetStatus() == Http::Response::Ok) return IpAddress(page.GetBody()); // Something failed: return an invalid address return IpAddress(); }