IPv6 changes in Qt5

Published Tuesday July 5th, 2011
9 Comments on IPv6 changes in Qt5
Posted in Internet, QtWebKit, Symbian

As you might know, Qt has had support for IPv6 since quite some time.
Now we have made some changes in Qt5 that relate to IPv6:

Shane has improved the support for binding TCP and UDP sockets. Originally there was QHostAddress::Any which meant any IPv4 ( Then at some point QHostAddress::AnyIPv6 was introduced to mean any IPv6. We changed this a bit: Now QHostAddress::Any means any IPv4/IPv6 and there is a new enum QHostAddress::AnyIPv4 that stands for

Martin has implemented a variant of the “Happy Eyeballs” IPv6 connection mechanism inside QNetworkAccessManager’s HTTP code.
This is a temporary measure that we’ll use for connecting to web servers. If the OS indicates support for both IPv4 and IPv6 and has connectivity for both, we will try to connect with IPv4 and IPv6 if we get both types of DNS records for this HTTP server.
Whichever address family connects first will then be used for all further connections to this server. The goal here is to deal with the possibility that IPv6/IPv4 packets get eaten up somewhere and we’d have timeouts and a bad user experience because of that.

To further express that we take IPv6 seriously, I also have removed the support to compile with QT_NO_IPV6. I think that every platform that Qt5 will run on also has support for IPv6.

We also haven’t forgotten the 4.8 branch. It will bring IPv6 support for Qt/Symbian. Stay tuned for that, I heard there should be a beta real soon now.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Internet, QtWebKit, Symbian


Jim says:

So.. in Qt5 QHostAddress::AnyIPv6 will be removed and replaced with QHostAddress::Any or both of them will exist?

Roger says:


It appears that he meant that the QHostAddress::Any will stand for IPv6 and IPv4 addresses (i.e. bind to both?).

shane says:

Both will exist.
AnyIPv6 means “use IPv6 only”
AnyIPv4 means “use IPv4 only”
Any means “use both protocols if the OS supports it, otherwise let the socket engine decide”

If you’re familiar with socket options, the IPV6_V6ONLY option is set for AnyIPv6 and cleared for Any.

Currently, windows XP and the SOCKS5 socket engine do not support dual stack sockets.
They will use IPv4 when Any is used to bind a socket.

Henkie says:

There should be a QT_NO_IPV4 for use on native IPv6-only networks (such as my LAN).

Oh, and: Thanks! Hopefully more developers will take IPv6 serious now, it’s so much nicer in many ways. And I love my 1208925819614629174706176 addresses, that vast address space just makes me feel all warm and fuzzy inside. Ok I kid, but it’s really important that we all cooperate to fix the Internet.

Connor says:

@shane Stop using an outdated OS like Windows XP. There is no reason to still support an old OS like that.

Jeremy says:

@shane unless, of course, XP is what your customers are running, and you would like them to continue being your customers.

Tobias says:

Its nice to support IPv6 of course – but I am wondering. I introduced myself to Qt some month ago and like it very much, and I am surprised, that there is no framework function to transport signals over IP. Why not?

shane says:

@Henkie – QHostAddress::Any should work fine on an IPv6 only network – you’ll just never get any IPv4 connections on the socket.
With the “happy eyeballs”, we’d expect the IPv4 connection to fail or timeout while the IPv6 connection would succeed.
Some mobile phone operators already have IPv6 only networks, so it is an important usage (though hard to test from the desktop)
A QT_NO_IPV4 would only be needed to support an OS that has no headers for AF_INET etc.

@Tobias – that’s a bit off topic, try fleshing out your requirement a bit more and discussing it in another forum. Blog comments aren’t good for dealing with multiple discussion threads.

Jeremy.Katz says:

Why is the happy eyeballs implementation a temporary measure?

The answer that occurs to me is that, hopefully, eventually, everyone will transition away from IPv4 and we’ll stop seeing IPv4 DNS records. I’m not holding my breath. If there is another reason, it would be nice to know about it. Particularly if there is a chance that application level changes will be required.

Commenting closed.

Get started today with Qt Download now