Unsolved How to send ping and receive data
-
i have 32 boards that connected network,
each board has ipaddress
so, i want check boards are connected correctly by using send ping
How to send ping and receive data ? -
@taek-seo said:
Hi
A quick way is to use QProcess and call external ping command
https://github.com/edhana/qt-ping-exampleIf thats not an option, you need to dive into networking
http://doc.qt.io/qt-5/qtnetwork-programming.html -
If thats not an option, you need to dive into networking
You can't compose ICMP message through Qt. So the only viable way is to send your own pseudo "ping" through a datagram for example and put a timeout to that. However, the devices should be aware of such communications and have to able to respond respectively.
-
-
not even when run with elevated privileges ?
No, not really. ICMP is really under the TCP/IP stack so you can't.
-
@kshegunov
ok that explains why all seem to run ping as external process to ping something :) -
@mrjj Thank you!!!
I solved!! by using QProcessQString nParameter = "-n"; QString pingCount = "1"; //(int) QString wParameter = "-w"; QString pingWaitTime = "10"; //(ms) pingProcess = new QProcess; int exitCode = pingProcess->execute("ping",strIpaddress[i]<<nParameter<<pingCount<<wParameter<<pingWaitTime); if (exitCode==0){ s_ApplyBoard->addItem(bdName[i]); }
and i want "Loading" shape mouse cursor when processing, use this :
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::restoreOverrideCursor(); -
This post is deleted! -
You can use boost to achieve that.
Check this boost asio ping example