PDA

View Full Version : How to know if a Url is reachable



SPir4L
11th September 2008, 11:11
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 :)

wysota
11th September 2008, 12:02
The only thing you can do is to connect to it using QTcpSocket (or QUdpSocket).

SPir4L
11th September 2008, 12:49
Could you please give me an example of code?

wysota
11th September 2008, 13:07
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

yogeshgokul
11th September 2008, 13:15
@ Wysota,
If you are suggesting to use QTcpSocket class, why dont you answer this post.

http://www.qtcentre.org/forum/f-qt-programming-2/t-qtcpsocketconnecttohost-15919.html