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

How to send ping and receive data

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 23.7k Views
  • 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.
  • T Offline
    T Offline
    taek seo
    wrote on 24 Mar 2016, 02:35 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 ?

    T 1 Reply Last reply 25 Mar 2016, 07:05
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 24 Mar 2016, 09:18 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

      K T 2 Replies Last reply 24 Mar 2016, 18:04
      1
      • M mrjj
        24 Mar 2016, 09:18

        @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

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 24 Mar 2016, 18:04 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
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 24 Mar 2016, 20:08 last edited by
          #4

          @kshegunov said:

          ICMP

          not even when run with elevated privileges ?

          K 1 Reply Last reply 24 Mar 2016, 20:49
          0
          • M mrjj
            24 Mar 2016, 20:08

            @kshegunov said:

            ICMP

            not even when run with elevated privileges ?

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 24 Mar 2016, 20:49 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

            M 1 Reply Last reply 24 Mar 2016, 20:52
            0
            • K kshegunov
              24 Mar 2016, 20:49

              @mrjj

              not even when run with elevated privileges ?

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

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 24 Mar 2016, 20:52 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
              • M mrjj
                24 Mar 2016, 09:18

                @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

                T Offline
                T Offline
                taek seo
                wrote on 25 Mar 2016, 06:59 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
                • T taek seo
                  24 Mar 2016, 02:35

                  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 ?

                  T Offline
                  T Offline
                  taek seo
                  wrote on 25 Mar 2016, 07:05 last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    flyingtree
                    wrote on 25 Mar 2016, 08:06 last edited by
                    #9

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

                    1 Reply Last reply
                    0

                    5/9

                    24 Mar 2016, 20:49

                    • Login

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