• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help Auto IP

Tegardee

The Boss
Joined
Jun 18, 2014
Messages
106
Reaction score
0
Location
Brazil
Hello friends, I managed to compile the tfs with a code of auto global ip, everything worked normal it takes the ip of good, the problem is that instead he picked up my Default Gateway is the IP of the Internet, it is grabbing the computer IP.

code:
Code:
if( g_config.getString(ConfigManager::IP) == "auto" )
     {
         char szHostName[128];
         if( gethostname( szHostName , 128) == 0 )
         {
              struct hostent* he = gethostbyname( szHostName );

              if( he != NULL )
              {
                  ip = inet_ntoa( * ( reinterpret_cast< in_addr* >( he->h_addr )));
              }
         }
     }

     else{
   ip = g_config.getString(ConfigManager::IP);
     }
how can i fixed it? thanks.
 
Last edited:

Similar threads

Back
Top