Get external IP C++ CLI
Hello, how can i get external IP of machine? Thanks :)
i make my own function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
HttpWebRequest^ request = dynamic_cast<HttpWebRequest^>(WebRequest::Create("http://myexternalip.com"));
HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());
Stream^ receiveStream = response->GetResponseStream();
StreamReader^ readStream = gcnew StreamReader(receiveStream, Encoding::UTF8);
int riadok = 0;
string temp[20];
while (String^ text = readStream->ReadLine())
{
if (riadok == 3)
{
splitString(temp, marshal_as<string>(text), " <");
return marshal_as<String^>(temp[5]);
}
riadok++;
}
|
Topic archived. No new replies allowed.