Wi-Fi is one of the 21st century’s great liberators. The ability to connect wirelessly to the Internet in a huge variety of locations is the enabling technology for all kinds of flexible working arrangements. Indeed, it has turned the coffee shop into one of society’s more productive work places.

But anyone who regularly uses Wi-Fi will be aware of an embarrassing problem: it sometimes takes an age to connect to Wi-Fi and sometimes connections are not possible at all. The awful truth about Wi-Fi is that all too often, it simply does not work.

And that raises an important question: why? What is it about these state-of-the-art wireless networks and the devices that connect to them that so often fails?

Today we get an answer thanks to the work of Changhua Pei at Tsinghua University in China and a few pals who have measured how long it took for 400 million different Wi-Fi sessions to connect. And they’ve used their data to work out what typically goes wrong and how it can be avoided.

Changhau and co gathered their data from an Android app called Wi-Fi Manager, which records the various stages involved in connecting to a Wi-Fi access point and how long they take.

Every Wi-Fi connection involves several steps. In the first step, the mobile device scans the airwaves for available Wi-Fi access points. Once an access point is selected, the two devices swap data packets. Then there is an authentication step, which often involves a password input. The final step is called DHCP (dynamic host configuration protocol), which provides the device with an IP address.

(Note that once a connection is established, the user may be taken to a gateway page that requires another password—the team does not include this step in its calculations.)

The question that Changhau and co address is, if successful, how long does this connection process typically take. And the answer will be depressingly familiar to Wi-Fi users. The researchers say that Wi-Fi connections fail an astonishing 45 percent of the time. And the time they take is hugely variable, with 15 percent of connections taking more than five seconds.

So what is going wrong? Changhau and co use a data-mining algorithm to crunch through the data to find out what kind of factors are associated with failed connections and long connection times.

It turns out that several factors significantly influence connection time and success. Perhaps the most important is whether the Wi-Fi network is public or private—private networks are significantly faster and have higher rates of connection success.

The mobile device’s operating system is another factor. The team says identical devices running different operating systems can have very significant differences in connection times and point the finger particularly at a heavily customized version of Android called FlyMe. The chipsets in both the mobile device and the access point can also impact connection times, with slower chips taking much longer.

Having found the factors that slow down connections, the team has created an algorithm that avoids the most obvious compromises and so speeds up connection times.

For example, this algorithm assesses whether access points are public or private. It then ignores the public ones and chooses the private network with strongest signal.

This approach significantly improves connections, say Changhau and co. The algorithm reduces connection failures to a rate of just 3.6 percent and reduces connection times by a factor of 10.

That’s an impressive result that will surely be appreciated by workers in coffee shops all over the world.

Ref: arxiv.org/abs/1701.02528: Why It Takes so Long to Connect to a WiFi Access Point