Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up all the alive machines connected to the network

Status
Not open for further replies.

sujin

Programmer
Jul 20, 2002
5
IN
Dear all,
I want to write an application that pop up all the alive machines connected to the network. I'm an armature do not know anything on this. Please any one guide me to successfully complete the application. Does it require any prior knowledge on networking?

Thanks.

SJ.
 
Hmm, this would require a little bit of knowledge of networking. I'm not entirely sure how you would do this. I'm assuming this would be a Linux C program. I would think that you could Broadcast an ARP request that would go to all computers on the network. Each computer would then send back an ARP response with it's MAC Address and IP Address and...yeah, there you go you would have all the IP's of the computers on the network. You would have to be familier with C network programming (TCP/IP, Sockets, etc). This sounds like an interesting task...I might try to do it myself. If anyone can debunk my theory go right ahead.

-bitwise
 
I'm not convinced that would work. It's been a while since I've looked into ARP, but I don't think it works that way. As I remember, an ARP request is used to translate an IP address into a MAC address. Therefore, you'd need to know the IP address of the computer in question in order to send it an ARP request. True, the ARP request is broadcasted, but part of the request is the IP of the computer whose MAC address you need. When a computer gets the ARP request, if the requested IP doesn't match its own IP, it's supposed to ignore the request. Your theory would work if the computers do a bitwise AND on the last octet of their own IP address and the last octet of the requested address.

If my ideas about ARP are wrong, please correct me.
 
Just after completing my last post, I had an idea...

Instead of sending an ARP request, you can broadcast a PING request. Any computers that are alive will respond to that request and give you information, including their IP...
 
Ok, see I didn't think that a PING, which would be an ICMP packet, would work, but I guess I really don't see why not. I knew that normally, an ARP request needed to specify the destination IP in its frame, but I wasn't sure if you could just send out a generic ARP broadcast. You are right though, ARP is traditionally used for translating IP addresses to MAC addresses since the hardware doesn't know anything about IP addresses. I guess when I thought of ping I just thought how I traditionally use it.

% ping computer_name

If however, ICMP doesn't need to know the host IP and it can be broadcast over the network then I guess that would work. I hope my attempts at sounding like I know something about networking aren't too hideous.

-bitwise
 
under Solaris:

ping -s 224.0.0.1 vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
The ICMP ping command can do what ARP cannot in taking a broadcast IP address and pinging every computer in the subnet range. The responses you get will be exactly what you need.
 
Problem is if the stations on the subnet are configured
to ignore icmp requests.
The ping command above (vgersh) will only talk to multicast enabled hosts. It is a good idea though.
ping -I 255.255.255.255 will accomplish the same thing.
Again it may fail if hosts have been configured in
paranoid manner.
 
Problem is if the stations on the subnet are configured
to ignore icmp requests.
The ping command above (vgersh) will only talk to multicast enabled hosts. It is a good idea though.
ping -I $myaddr 255.255.255.255 will accomplish the same thing.
Again it may fail if hosts have been configured in
paranoid manner.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top