Inconsistent QHostAddress behavior

  • I have a QTcpSocket client that connects with a Remote (on Internet) tcp server. When I call socket.localAddress().toString() immediately after WaitforConnected call. It returns local/lan IP in format ::ffff: (IPv4 mapped IPv6). However, if I call it later after some data transfer then same call returns (standard IPv4 format). After first call, QHostAddress.protocol() returns IPv6Protocol and after second call QHostAddress.protocol() returns IPv4Protocol.

    Remote server and local server are both using IPv4 addresses and my ISP doesn't support IPv6, so why is the first response in IPv6 format? How to get correct format?

Log in to reply