Get the ping from a remote target with Qt (Windows/Linux)

前端 未结 4 2843
不知归路
不知归路 2021-02-20 17:19

Currently I use this code for retrieving the ping of a target system. However it works so far only under linux and it is likely dependent on the locale settings. To add suppor

4条回答
  •  情深已故
    2021-02-20 17:30

    You would need write your code for this without QAbstractSocket. In short, this base class was not designed for this use case.

    The reason is that you would need to use raw sockets and run as root; that is also why you usually see the setuid flag set on the ping executable on Linux.

    ICMP is "connectionless", and as such the Qt class is not feasible for it as it does not provide sending data to a specific host, etc.

    You can read the more thorough explanation in here.

提交回复
热议问题