6

How to get the system network status in Qt like we get event hits in .NET so that each and every time when we connect network get a signal of a status of the network connection?

Is there any function that have same functionality as I mentioned above?

Using ping and other methods of network configuration takes a small amount of time.
But I need to display it as fast as I could other than using a specific port to listen to the socket and display its error.

Can any one help me out of it?

Ezee
  • 4,214
  • 1
  • 14
  • 29
Dev
  • 95
  • 1
  • 12
  • You can see this post: http://stackoverflow.com/questions/2475266/verfiying-the-network-connection-using-qt-4-4 – Nejat Oct 07 '14 at 10:07
  • I have already tried this method.But it's not a right answer as it fails with wifi. – Dev Oct 07 '14 at 10:18

1 Answers1

1

I found a good example of getting network information using QT: http://developer.nokia.com/community/wiki/Get_Network_information_using_Qt

For instance, you can get the signal strength from the public member, networkSignalStrength, of QSystemNetworkInfo. And, if you take a look at QSystemNetworkInfo class reference, you can find signals such as networkSignalStrengthChanged so that you can handle something when network signal strength gets changed.

Hope this helps!

sam
  • 2,780
  • 1
  • 17
  • 30
  • QSystemNetworkInfo class is part of the QtMobility APIs, which is unfortunately unavailable for desktop targets.So I cannot use this method for the desktop applications – Dev Oct 07 '14 at 09:53
  • QtMobility can be compiled for desktop separately, but as I see in Qt 5 it doesn't exist at all, some parts of it were moved to the Qt libs, but QSystemNetworkInfo class missed in Qt 5. @SLee The answer is not useful at all. – Max Go Oct 07 '14 at 10:02