This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Checking for network connection

Tags: None
(comma "," separated)
User avatar
Mar91
Registered Member
Posts
55
Karma
0

Checking for network connection

Sun Apr 29, 2012 7:35 pm
I'd like to activate my appliacation when the network connection is ready. I have found this:

//test to see if networking is enabled on the system
if(Solid::Networking::status() == Solid::Networking::Connected)
{
kDebug() << "Networking is enabled. Feel free to go online!";
}
else
{
kDebug() << "Network not available.";
}

In both case ( if the eth cable is plugged or not ) the message is Network not available, else if i can surf the internet. What's wrong?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Checking for network connection

Fri May 04, 2012 11:20 am
Make sure that you consider Solid::Networking::Unknown to be connected as well. On some systems, it is not possible for KDE to determine if your system has an active network connection, in which case Unknown will be returned instead.

This functionality is most reliable on systems that use NetworkManager.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft