all connecting local ip addresses
Hi,:wave:
I am new to AD and networking,
I'd like to get all online clients'IP addresses (that be e.g \\192.168.1.xxx\Client1, \\192.168.1.xxx\Client2, \\192.168.1.xxx\Client3 , etc)
My code in Linux is
Code:
int main()
{
const char* const host = "computername" ;
const hostent* host_info = 0 ;
host_info = gethostbyname(host) ;
if(host_info)
{
std::cout << "host: " << host_info->h_name << '\n' ;
for( int i=0 ; host_info->h_addr_list[i] ; ++i )
{
const in_addr* address = (in_addr*)host_info->h_addr_list[i] ;
std::cout << " address: " << inet_ntoa( *address ) << '\n' ;
}
}
else herror( "error" ) ;
}
I'd like to do this in a pure MFC application, what api functions should I look up ?
Thank you.
Re: all connecting local ip addresses
Did you try using the same code you used in Linux?
Re: all connecting local ip addresses
Thank you for your reply,
I didn't try it in Windows's console application. I 've been looking for a class or functions if available in MFC to do similar tasks.
Re: all connecting local ip addresses
There is no any MFC wrapper for gethostbyname function.
The same - for inet_ntoa