[Qt-interest] QHostAddress::setHost() not working
Thiago Macieira
thiago.macieira at trolltech.com
Sat Mar 14 15:02:03 CET 2009
Neel Basu wrote:
>Here goes my code
>-------------------------
>void ProtocolSegment::setHost(const QString& addr){
> qDebug() << "Host " << addr;
> host__.setAddress(addr);
> qDebug() << "setting Host " << host__.toString();
>}
>--------------------------------
>I am calling setHost("google.com")
>Output is
>------------------------------
>Host "google.com"
>setting Host ""
>--------------------------------
>which means setAddress() is not working correctly.
>I've also tried host__ = aadr e.g. the operator=() overload
>But same result
>
>Any Ideas ??
Yes. What are you exactly trying to do?
The documentation to QHostAddress::setAddress specifically says that it
supports only IPv6 or IPv4 addresses:
Sets the IPv4 or IPv6 address specified by the string
representation specified by \a address (e.g. "127.0.0.1").
Returns true and sets the address if the address was successfully
parsed; otherwise returns false.
You passed a hostname. I think you wanted QHostInfo, not QHostAddress.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090314/1944403e/attachment.bin
More information about the Qt-interest-old
mailing list