views:

101

answers:

2

How can I enumerate all machine names and IPs of remote computers in the local network ?

Note: NOT on Windows (how to do that one finds via google), I need something that works on Linux ! Or a C/C++ sample would also do it, I can call libc from C#.

A: 

Look at the source of smbtree from samba.

jedi_coder
A: 

The easiest way would be to send out a broadcast icmp packet, and see who responds, and count that. This should be doable in a pretty standard manner with any programming language that has standard networking libraries for tcp/ip.

supercheetah
You mean ping an entire range.
Quandary
That's what ping does, it sends an ICMP packet out with an echo request. If it's sent out to the broadcast address for the network, all the computers on the network will see it and respond. This is something that is basic to networking concepts. The broadcast address is the IP address AND'ed with the subnet mask. Try it with ping, and you'll see what I'm talking about (in Linux, ifconfig will tell you what the broadcast address is for the network, and also make sure your router allows these packets).
supercheetah
The idea is good, just that none of the computer responds. I read that so far, that's pretty normal.
Quandary