LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve IP addresses of computers connected to router

thank you Eren for the sample code, it works as what I expected it to be, one more follow up question since the IP address was already placed on the string holder, how can I use it as an argument to a ping command?

 

so

 

system("cmd /c -n 10 get_ip_address_from_string_holder >pingresult.txt");

 

regards and appreciate much the help.

 

0 Kudos
Message 11 of 17
(2,204 Views)
i forgot, I could use sprintf to load to the ping parameters, my main concern now is that if I issued a -t option, is there a way to automatically stop the ping from within CVI app? Killing the process maybe? But what if I have to ping dfferent computers on the network, so killing the ping process will kill all ping execution.
0 Kudos
Message 12 of 17
(2,197 Views)

Hi again,

 

I changed the previous code a little to include the ping functionality.

I added a Ping button. In its callback I called GetCtrlVal to read the IP in string holder and sprintf to build the system command.

 

Use the Ping button after you selected (double-clicked) an IP address from the list. 

That's all. See the attachment.

 

Hope this helps, 

S. Eren BALCI
IMESTEK
0 Kudos
Message 13 of 17
(2,196 Views)

Hi Eren,

 

Again thank you, I have already achieve the ping command parameter inclusion as what I have posted just above your reply,  my main concern now is how can I kill the process if I issued a -t option just like

 

ping ipaddress -t ,

 

the problem lies if I have a multiple instance of ping process running at the background. How can I kill each one that corresponds to the IP address such that if I issued a

 

ping ipaddress -t 

 

on, ip1, ip2, ip3 and I want to stop just the ip2 then later user want to stop ip3 ping process, is there an easy way to achieve it?

 

thank you very much.

0 Kudos
Message 14 of 17
(2,189 Views)

The help for ping says that it is possible to interrupt the loop with Control-C or Control-Break key combinations.

 

There are functions to write characters to the standard output (the DOS command prompt) but they accept ASCII characters only.

I do not know a way to put key combinations.

 

There is a FakeKeystroke function, but that works only on CVI panels probably. 

S. Eren BALCI
IMESTEK
0 Kudos
Message 15 of 17
(2,178 Views)

just got back, thanks Eren,

 

would CreateProcess() can be used instead of the system to achieve it?

 

FakeKeystroke I think would not be enough if you have a multiple instance of ping.exe on the process. Idea would be have a new command button that determines the process ID of the ping execution of each IP address.So,

 

scan connected devices via arp->list down each ip address found on a string box-> command button ping to ping the ip with ping -t option -> if user wants to stop the ping another button must be pressed attached to the ping process of the particular ip address. There should also be an error detection that if ping execution timeout just once in the execution, the ping will be stopped and the test fails.

 

idea seems easy but implementing or coding it is very difficult at least for me.

Message Edited by cblog16 on 11-17-2009 10:20 PM
0 Kudos
Message 16 of 17
(2,134 Views)

Which version of CVI are you useing  ??

 

with version 8.5  you have a built in ping function that  could be used.

 

(internet library)

 

just place this call in a timer callback and you can enable or disable the timer to start and stop sending the ping.

 

 

Colin

 

 

0 Kudos
Message 17 of 17
(2,123 Views)