Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to send ping and receive data
Forum Updated to NodeBB v4.3 + New Features

How to send ping and receive data

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 24.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • taek seoT Offline
    taek seoT Offline
    taek seo
    wrote on last edited by
    #1

    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 seoT 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @taek-seo said:
      Hi
      A quick way is to use QProcess and call external ping command
      https://github.com/edhana/qt-ping-example

      If thats not an option, you need to dive into networking
      http://doc.qt.io/qt-5/qtnetwork-programming.html

      kshegunovK taek seoT 2 Replies Last reply
      1
      • mrjjM mrjj

        @taek-seo said:
        Hi
        A quick way is to use QProcess and call external ping command
        https://github.com/edhana/qt-ping-example

        If thats not an option, you need to dive into networking
        http://doc.qt.io/qt-5/qtnetwork-programming.html

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        @mrjj, @taek-seo

        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.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kshegunov said:

          ICMP

          not even when run with elevated privileges ?

          kshegunovK 1 Reply Last reply
          0
          • mrjjM mrjj

            @kshegunov said:

            ICMP

            not even when run with elevated privileges ?

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @mrjj

            not even when run with elevated privileges ?

            No, not really. ICMP is really under the TCP/IP stack so you can't.

            Read and abide by the Qt Code of Conduct

            mrjjM 1 Reply Last reply
            0
            • kshegunovK kshegunov

              @mrjj

              not even when run with elevated privileges ?

              No, not really. ICMP is really under the TCP/IP stack so you can't.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @kshegunov
              ok that explains why all seem to run ping as external process to ping something :)

              1 Reply Last reply
              0
              • mrjjM mrjj

                @taek-seo said:
                Hi
                A quick way is to use QProcess and call external ping command
                https://github.com/edhana/qt-ping-example

                If thats not an option, you need to dive into networking
                http://doc.qt.io/qt-5/qtnetwork-programming.html

                taek seoT Offline
                taek seoT Offline
                taek seo
                wrote on last edited by taek seo
                #7

                @mrjj Thank you!!!
                I solved!! by using QProcess

                    QString 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();

                1 Reply Last reply
                0
                • taek seoT taek seo

                  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 seoT Offline
                  taek seoT Offline
                  taek seo
                  wrote on last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    flyingtree
                    wrote on last edited by
                    #9

                    You can use boost to achieve that.
                    Check this boost asio ping example

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved