phost = gethostbyname(szhostname);
//for( i = 0; phost!= NULL && phost->h_addr_list[i]!= NULL; i++ )
//{
i=0;
int j;
int h_length=4;
for( j = 0; j<h_length; j++ )
{
CString addr;
if( j > 0 )
strIP += ".";
addr.Format("%u", (unsigned int)((unsigned
char*)phost->h_addr_list[i])[j]);
strIP += addr;
}
// str now contains one local ip address - do whatever you want to do with it (probably add it to a list)
//}
}
return true;
}