Results 1 to 5 of 5

Thread: Checking for internet connection

  1. #1
    Join Date
    Oct 2013
    Posts
    12
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Checking for internet connection

    I can't seem to find in the documentation how one can check whether there is an active internet connection available. I was looking at the QNetworkSession class but can't seem to work it out.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Checking for internet connection


  3. #3
    Join Date
    Oct 2013
    Posts
    12
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Checking for internet connection

    Thanks. I did try that. Returns true even when there isn't any connectivity.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Checking for internet connection

    I think the only way is to try to connect to a server at a well-known address.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Checking for internet connection

    Quote Originally Posted by Lesiok View Post
    I think the only way is to try to connect to a server at a well-known address.
    Right, depends on what kind of information the thread starter was looking for.
    Obviously if the question is "can I reach a specific host" then the only way to determine that is to try to connect to it.

    The network configuration classes only tell you if there is even a point in trying that, i.e. if there is no connected network interface then any attempt will fail locally already.

    Cheers,
    _

Similar Threads

  1. No internet connection when deploying application
    By n1ghtly in forum Qt Programming
    Replies: 4
    Last Post: 9th August 2012, 13:00
  2. Checking internet connection..
    By Gokulnathvc in forum Newbie
    Replies: 3
    Last Post: 24th February 2012, 10:11
  3. Can remote compiler work over a slow internet connection?
    By Rakula in forum Installation and Deployment
    Replies: 0
    Last Post: 6th December 2011, 13:05
  4. Replies: 0
    Last Post: 11th November 2011, 19:18
  5. How to detect an internet connection ?
    By ouekah in forum Newbie
    Replies: 1
    Last Post: 29th March 2010, 22:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.