Results 1 to 5 of 5

Thread: How to know if a Url is reachable

  1. #1
    Join Date
    Aug 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default How to know if a Url is reachable

    Hi all,

    I want to check if a text, that the user entered in a QString, is a valid
    and reachable Internetaddress (or even better a valid and reachable URL).

    I looked into the docs and found various classes dealing with network things
    but nothing that suits my needs. Can somebody suggest me a Classname to use?
    I don't want to use this address anywhere else, I only want to check if it can
    be accessed.


    PS: The address I've to check is not a webpage address but an online radio stream; for example:

    mms://xx.xxx.xx.xxx:xxxx/radio_name

    I hope someone could help me

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to know if a Url is reachable

    The only thing you can do is to connect to it using QTcpSocket (or QUdpSocket).

  3. #3
    Join Date
    Aug 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to know if a Url is reachable

    Could you please give me an example of code?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to know if a Url is reachable

    Use QAbstractSocket::connectToHost() with proper host and port data and then when you get connected, try downloading the stream using a proper MMS command.

    You can visit this link to learn more about the MMS protocol: http://en.wikipedia.org/wiki/Microsoft_Media_Services

  5. #5
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to know if a Url is reachable

    @ Wysota,
    If you are suggesting to use QTcpSocket class, why dont you answer this post.

    http://www.qtcentre.org/forum/f-qt-p...ost-15919.html

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
  •  
Qt is a trademark of The Qt Company.