Introducing Netplay, currently not extremely polished, and not yet fully tested..

Thanks to shuffle2 for fixing the linux build on an earlier version, still pending other linux fixes :P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3220 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s
2009-05-13 21:50:24 +00:00
parent b71ad0f018
commit 176d528719
14 changed files with 3391 additions and 1344 deletions

View File

@ -20,6 +20,7 @@
//
// 3. This notice may not be removed or altered from any source distribution.
//
// ** ALTERED SOURCE : replaced GetPublicAddress() **
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
@ -210,16 +211,24 @@ IPAddress IPAddress::GetPublicAddress()
// (not very hard : the web page contains only our IP address)
IPAddress PublicAddress;
std::string PageBody;
// Connect to the web server and get its index page
Http Server("www.whatismyip.org");
// www.whatismyip.org is so slow that it time outs after ~60s
// better use this one instead, it is must faster... here :P
Http Server("www.monip.org");
Http::Request Request(Http::Request::Get, "/");
Http::Response Page = Server.SendRequest(Request);
// If the request was successful, we can extract
// the address from the body of the web page
if (Page.GetStatus() == Http::Response::Ok)
PublicAddress = Page.GetBody();
PageBody = Page.GetBody();
size_t str_start = PageBody.find("IP : ", 0) + 5;
size_t str_end = PageBody.find('<', str_start);
PublicAddress = PageBody.substr(str_start, str_end - str_start);
return PublicAddress;
}