How can I ping in C ++ / Qt without using QProcess?
I would like to ping an ip address in my Qt application before running an external program.
I would like to write ping code without using ping.exe (and execute the process). The problem is when I "ping 127.0.0.1", it takes 3 seconds for the ping process to complete on windows. I only need a quick check (less than 500ms) before executing (instantaneously) my external program.
I would like to use QNetwork or something similar.
+3
source to share
1 answer
If you don't mind using platform-specific code in your Qt application, you can check:
https://evileg.com/en/post/167/
for example using ICMP echo API for windows and
for liboping, a Linux C library for generating ICMP echo requests.
0
source to share