11-03-2009 04:48 AM
Hello All,
First thanks for taking the time to read my queries, basically my problem is below
1. I have a Dlink router DIR-635 that is connected through my PC, and another ethernet switch connected to the router with 5 more PC's connected on the switch,
PC-->router-->Ethernet Switch--->5 PC's
Now, the router is giving this 5 PC's each with IP address, is there a way I can retrieve this IP address automatically using CVI? The idea would be once I have this IP addresses acquired by the CVI program, I will send each of the 5 PC's a ping with ping <ip address> -t>ipaddress.txt.
2. Is there also a way, where once a new PC is connected to the ethernet switch, the CVI program will automatically detect and display the IP address given by the router on the program and eventually send the same ping command.
A sample program is greatly appreciated. Thank you in advance.
Regards,
James
11-04-2009 07:17 AM
11-04-2009 09:41 AM
through CVI
execute the command arp -a >iplist.txt
this will generate a text file "iplist.txt" with all of the ip addressess connected to the network
(you amy get outside addressess you have open links to the internet.)
open the iplist .txt file and read in the list of ip addressess
as you should allready know the range of ip addressess that have been allocated to the pc by the router it should be an easy exercise to identify the IP addresses and set up the ping commands.
colin
11-04-2009 09:55 AM
Thanks Colin for the full description.
I do not get outside IP addresses when I run the arp command. I do get the PC's that are on a different subnet.
As a plus, you get the Physical Addresses.
RayR
11-04-2009 11:26 AM
I only get the IP addresses of computers to which I am currently connected. Computers that are on the network, but not currently with an active connection to mine, do not show up.
I guess the success of this approach depends on whether you are running a simple hub or a switch based system.
JR
11-04-2009 11:49 AM
Hummm...
Well... you could always go through a brute force approach..
Create an algorithm to ping all possible addresses within your subnet and look for replies. Don't bother doing statistics (ie repeat test 4 times) as you only case about a response and not lost packets.
11-09-2009 07:30 PM
I was away so have not replied early on the topic,
First thank you all for the help, this will be a good start for me to achieve what want my application to perform.
My next exercise would be to place this ip list with their corresponding physical address(MAC) to a text box and ping each one, how can I drop those IP list on the textbox? thanks in advance.
11-09-2009 08:05 PM
I forgot, I drop those Ip list using below
myfile = fopen("C:\\work\\iplist.txt","rt");
while (fgets(fileBuf,256,myfile))
SetCtrlVal(panelHandle,PANEL_TEXTBOX,fileBuf);
How can I select each IP address one by one and display on a separate string textbox? In this way I can ping each IP individually.
11-10-2009 02:27 AM
Hi,
You can find a small sample code for the functionality you requested.
Hope this helps,
11-10-2009 07:23 PM
thanks Eren for the sample, I will look at it because I can easily implement the same scenario on LV, just need to duplicate it using CVI,
will let you know