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 could I check whether device is online using Qt?
Forum Updated to NodeBB v4.3 + New Features

How could I check whether device is online using Qt?

Scheduled Pinned Locked Moved General and Desktop
network
6 Posts 3 Posters 2.9k Views 2 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.
  • jiancaiyangJ Offline
    jiancaiyangJ Offline
    jiancaiyang
    wrote on last edited by
    #1

    Is there any effective way to check whether a certain device is online, the device may vary from desktop to mobile devices.
    By the way, I used QNetworkConfigurationManager::isOnline( ) to do this task, but unfortunately, when I closed my desktop connection ( Ubuntu 15.04 Enable network unchecked ), this function returned true as always, I bet because there was a lo ( loopback ) adapter is always active within my desktop, so it always returned true.

    我们自己的论坛:http://qtdream.com
    擅长三维角色仿真动画。

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      QNetworkConfigurationManager manages your configuration not the remote one.
      To detect if a device (network interface) is online you could use a ping message

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      jiancaiyangJ 1 Reply Last reply
      0
      • M mcosta

        Hi,

        QNetworkConfigurationManager manages your configuration not the remote one.
        To detect if a device (network interface) is online you could use a ping message

        jiancaiyangJ Offline
        jiancaiyangJ Offline
        jiancaiyang
        wrote on last edited by
        #3

        @mcosta Do I have to try to ping some site in order to get to know whether my device could get access to internet, right?

        我们自己的论坛:http://qtdream.com
        擅长三维角色仿真动画。

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TheHawk
          wrote on last edited by
          #4

          Will the devices also run a Qt app? If so, you could make the devices emit a heartbeat to indicate them being online.

          jiancaiyangJ 1 Reply Last reply
          0
          • T TheHawk

            Will the devices also run a Qt app? If so, you could make the devices emit a heartbeat to indicate them being online.

            jiancaiyangJ Offline
            jiancaiyangJ Offline
            jiancaiyang
            wrote on last edited by
            #5

            @TheHawk Thanks, that's a way being able to keep alive when long connection is needed. There are several articles talking about TCP/IP heart beat, Do I need to do it myself, or there are existing heart beat API available?

            我们自己的论坛:http://qtdream.com
            擅长三维角色仿真动画。

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TheHawk
              wrote on last edited by
              #6

              I woulden't know actually. I think there will be one but why not make it yourself? It's not really complicated.

              The slaves emit a certain data string to the master indicating them being alive once every 5 minutes for instance. The master keeps track of the slaves and knows when it doesn't receive anything from a slave after 5 mins its offline and perhaps could try to request its status in case the packet got lost or something similar.

              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