mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
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:
13
Externals/SFML/src/SFML/Network/IPAddress.cpp
vendored
13
Externals/SFML/src/SFML/Network/IPAddress.cpp
vendored
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user