Results 1 to 3 of 3

Thread: Checking network availability

  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Checking network availability

    I'm currently writing a very small app designed to perform auto-authetication to a wifi network. The case is a bit weird :
    1. the OS network layer first connects to the wifi network (unencrypted)
    2. the user log into the network through a browser
    3. the network connection is closed by the server every hour or so

    My goal is to get rid of step 2 and 3. I already achieved half of it. Authentication is as simple as a properly formatted post reqest to a static IP. The second part however is giving me headaches... I tried several methods to determine whether the connection was working or not (including but not limited to QTcpSocket::connectToHost(), QHostInfo::fromName() and QHttp::get()) and none worked properly... It looks like there is some caching somewhere inside Qt which renders these approaches plain useless (or I may also be doing something wrong...).

    Any hints on how to achieve this in a pure Qt way?
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Checking network availability

    Do you mean that connectToHost still works if there's no signal, therefore no connection?
    If that is the case, I would like to buy your computer... Internet with to ISP's. That's SF .

    Really, there are some platform dependent solutions... I can give you some hints on Windows, but I assume you need something for Linux.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Checking network availability

    Quote Originally Posted by marcel View Post
    Do you mean that connectToHost still works if there's no signal, therefore no connection?
    If that is the case, I would like to buy your computer... Internet with to ISP's. That's SF .
    No SF... The network connection is still active but the wifi router does not treat request properly, it forwards the user to the login page when using a browser. The trouble is that if you are downloading things, or playing on the net you got screwed before you have a chance to fix things... My approach is to periodically check for working network connection by sending a get request to a fixed address (I know exactly what I'm supposed to get back) and determine by a simple comparision whether the network is fully working or needs re-authentication.
    Current Qt projects : QCodeEdit, RotiDeCode

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.