PDA

View Full Version : QHostAddress::toString



spraff
22nd November 2008, 16:53
I have a QTcpSocket * s which is connected to another socket at localhost.

s->peerAddress().toString() returns "0:0:0:0:0:FFFF:7F00:1%0" which isn't what I was expecting. Shouldn't it be "::1"? Any idea why not?

I gather the % sign has something to do with scoping, I'm guessing %0 is implicit if not specified and QHostAddress::toString is just being liberal with its output. Is there a way to get it to print the address to a nicer string? The above example could be written "::FFFF7F00:1" I believe. Is there a function which will do this?