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 ping an ip address and port with Qt
Forum Updated to NodeBB v4.3 + New Features

How to ping an ip address and port with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 5.4k 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.
  • VolebabV Offline
    VolebabV Offline
    Volebab
    wrote on last edited by
    #1

    How can I ping an i address and port using Qt without using QProcess? I want to know if the ip:port is online and how long (in ms) it takes to respond.

    the_T kshegunovK 2 Replies Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      This question was already asked recently, please search in the forum.
      As far as I know ping is something special and cannot be done easily (it is not Qt issue).
      Most probably you will have to use QProcess with ping command or something else.
      Depending on what is listening on that IP/port you could send a request and wait for the response and measure the time?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • VolebabV Volebab

        How can I ping an i address and port using Qt without using QProcess? I want to know if the ip:port is online and how long (in ms) it takes to respond.

        the_T Offline
        the_T Offline
        the_
        wrote on last edited by
        #3

        @Volebab

        As @jsulm said, its hard to do and it depends on the platform you use. MSDN provides some methods such as IcmpSendEcho but its Windows only (I have never tried that)
        The other way is to do lots of coding ... (using google will result in some stackoverflow postings)

        -- No support in PM --

        1 Reply Last reply
        0
        • VolebabV Volebab

          How can I ping an i address and port using Qt without using QProcess? I want to know if the ip:port is online and how long (in ms) it takes to respond.

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

          @Volebab

          How can I ping an i address and port using Qt without using QProcess?

          As @jsulm remarked, you can't. Ping is part of ICMP and is a low-level protocol (under the TCP/IP stack), so it's not accessible through Qt means.

          I want to know if the ip:port is online and how long (in ms) it takes to respond.

          You can try opening the port directly instead. See QTcpSocket or QUdpSocket (depending on the listening application) for inspiration.

          Read and abide by the Qt Code of Conduct

          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