WININET giving different results on winserver 2012 r2, for http requests

To add comments, please log in or register
Tusher Ahmed
169
Tusher Ahmed  

on win-7, this  gives me my  PC's ip : 53.253.34.23 
But when i run on winserver vps, it returns some hex type codes (not sure what is it) : 2001:19f0:ac01:b37:7d64:91c:6013:2cfd

My 2 guesses are :
1. the url giving unsuitable results or unicode/font issues

2. wininnet not working properly

/////////----------------------------------

int OnInit() {

  string myIP = httpGET("http://icanhazip.com/");

  Print("My machine's IP is ", myIP);

  return(INIT_SUCCEDED);
}

//////////////////////////////-------------------------------------the implementation
string httpGET(string strUrl)
{
   int handler = hSession(false);
   int response = InternetOpenUrlW(handler, strUrl,"",0, 
             INTERNET_FLAG_NO_CACHE_WRITE |
             INTERNET_FLAG_PRAGMA_NOCACHE |
             INTERNET_FLAG_RELOAD);
   if (response == 0) 
        return(false);
        
   uchar ch[100]; string toStr=""; int dwBytes, h=-1;
   while(InternetReadFile(response, ch, 100, dwBytes)) 
  {
    if (dwBytes<=0) break; toStr=toStr+CharArrayToString(ch, 0, dwBytes);
  }
  
  InternetCloseHandle(response);
  return toStr;
}
Alain Verleyen
36042
Alain Verleyen  
It's an IPv6.
Tusher Ahmed
169
Tusher Ahmed  
Alain Verleyen:
It's an IPv6.

thanks very much sir. i didn't notice the ipv6---heha.

But when if i visit the url in browser, it returns ipv4 of the server .why so?

To add comments, please log in or register