Getting the response from ofSystem() or get ping from hardcoded devices on network

How can I get the responses from ofSystem(), straight forward I guess.

To give more detail, I want to ping some devices to check they are on the network, I thought using ping via ofSystem() was a fast way (I cannot add functionality to all of the devices so ping is enough to know they are there and on). If there is away to do this it would also solve my problem.

1 Like

do something like

string response = ofSystem("blah blah");

regards
Davide

Great, thanks

For future reference, the ping operation will not stop until it is told, if one ping is enough (it is for me), this works

cout << ofSystem("ping -c 1 127.0.0.1") << endl;

The -c 1 tells how many times to ping before getting the complete response.

for my own future reference.

this call to ofSystem is blocking my app if the internet is down / connection is unsuccessful.

here is my way of making this threaded: