|
-
April 8th, 2011, 08:47 PM
#1
all connecting local ip addresses
Hi,
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.
-
April 9th, 2011, 02:19 AM
#2
Re: all connecting local ip addresses
Did you try using the same code you used in Linux?
Victor Nijegorodov
-
April 9th, 2011, 06:58 AM
#3
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.
-
April 9th, 2011, 07:13 AM
#4
Re: all connecting local ip addresses
There is no any MFC wrapper for gethostbyname function.
The same - for inet_ntoa
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|