[Qt-interest] Discover IP address and Turn Into QUrl
Bryce Salmi
Bryce.Salmi at zoran.com
Tue Sep 22 18:29:18 CEST 2009
Qt Interest,
I have been trying to get my IP address (on embedded Qt with ARM)
rather than set it statically. So far I have successfully been able to
get the IP and turn it into a char* where I can printf( "%s",ip); and
have it return the IP address as a dotted decimal (192.168.1.20).
However, I am trying to use the IP in an HTTP query to invoke a cgi
script. This works perfectly when I set the IP address statically. Here
is an example assuming ip is a (char *) with the IP already set:
QNetworkAccessManager *manager = new QNetworkManager(this);
QNetworkRequest request;
Request.setUrl(QUrl(("http://%s/something.cgi", ip)));
QNetwork Reply *reply = manager->get(request);
Testing with printf's and such showed that this should work, I end up
getting http://192.168.1.20/something.cgi but it does not start the
script. Am I missing something obvious?
Bryce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090922/e94bbf7e/attachment.html
More information about the Qt-interest-old
mailing list