Good day.

The question arose how to manage the ping process in C ++ (Qt). With QProcess :: execute, I run ping with the -t option, and ping the server. The problem is that I do not know exactly when he will respond to the ping, and, accordingly, I need to organize the reception of response ICMP packets, and, in addition, send a command to stop the ping process. How should this be organized? Open udp socket, catch the packet and kill the ping.exe process? Or can this be done somehow simpler?

  • 2
    Why make a bike? Open the socket, make the connection and send / receive the packet. Or find the source code ping - they are lying online - modify them to suit your tastes. - nick_n_a February
  • Here are the ping sources one of the variants cyberguru.ru/cpp-sources/network/iskhodnik-pinga-ping.html - nick_n_a
  • You can ping the -n option and specify that only one packet be sent. With QProcess, you can track the completion of a process. There are no built-in tools for working with the ICMP protocol in Qt. - maestro
  • one
    ICMP is a completely separate protocol that has (almost) nothing to do with UDP . Neither TCP nor UDP sockets accept ICMP packets, but can respond to states sent via ICMP. - user194374

0