[Qt-interest] Discover IP address and Turn Into QUrl

Colin S. Miller no-spam-thank-you at csmiller.demon.co.uk
Tue Sep 22 21:47:14 CEST 2009


Bryce Salmi wrote:
> 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:
> 
>  
> 
Bryce,
Are you trying to access a webserver running on the same machine as
your Qt program?

If so, then
http://127.0.0.1/somedir/somescript.cgi
should work;
127.0.0.1 is always the local address.

HTH,
Colin S. Miller




More information about the Qt-interest-old mailing list