C ++ Boost.asio Ping

I am trying to create a program that lists all the IP addresses of devices on a network. One of the main components of this is the ability to connect ping devices. This program should work on Linux, Windows and Mac, so I chose the Boost library.

I managed to find this example in the documentation: http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/icmp/ping.cpp

I am well versed in C ++ using OpenGL 3.1 and Shaders, but when I run this program, it runs over and over again (454+) and realizes that it throws me on a loop (not a pun), it seems to contain significant number of abbreviations, functions that I have never seen, etc.

Is there an easier way for a ping machine with Boost: asio? or is there a way that I can run this method just 4 times and return the average response time?

+2
source share
1 answer

In a related example, you need to change the handle_receive function to turn on the counter. When it is called four times, you indicate that the io_server object stops (for this you either need to make it global, or save the link to it in the pinger class), and not call start_receive .

+3
source

Source: https://habr.com/ru/post/987610/


All Articles