top of page
Search

How does a Wi-Fi device know when to reconnect?

Writer: Bhanu Prasad
Bhanu Prasad
2 hours ago
3 min read

You walk out of Wi-Fi range, come back a minute later, and your phone reconnects on its own. No cable was unplugged and nothing told the phone "you're back." So how does it know?

In this post we'll walk through exactly what the device notices, and what it does about it, in plain words.

Why this is a puzzle

With a wired connection, the answer is easy. When you unplug the cable, the network card sees the physical link go down. Plug it back in and the link comes up, which triggers a fresh connection.

Wi-Fi has no cable. The link is just radio signal, and signal fades gradually rather than switching off. So the device has to work out for itself that the connection is gone, and later that it is worth trying again.


The device starts at position 1 inside the AP's coverage, then moves to position 2, where it can no longer see the SSID.

Step 1: Noticing the connection is gone

While connected, the device is constantly listening and talking to the access point (AP). As it walks out of range, three warning signs show up:

•         Missed beacons. The AP sends a beacon frame about 10 times a second. When the device stops hearing several in a row, something is wrong.

•         No acknowledgements. In Wi-Fi, every unicast frame the device sends should be answered with an ACK from the AP. No ACK means the frame never arrived.

•         Retries pile up. With no ACK, the device resends the frame and sets the Retry bit. Many retries in a row mean the link is failing.

Once these cross the device's internal limit, it decides the link is lost. It drops the connection on its side and goes back to looking for a network.



When a frame gets no ACK, the device resends it with the Retry flag set to 1. A long run of these in Wireshark means the link is failing.


Step 2: Finding the network again

After dropping the link, the device keeps scanning for networks it knows. It does this in two ways:

•         Passive scan: it listens for beacons from nearby APs.

•         Active scan: it sends a probe request asking "is my SSID here?" and waits for a probe response.

As soon as you walk back into coverage, one of these succeeds. The device then repeats the normal joining steps:

1.       Authenticate: prove it is allowed to join (open or SAE for WPA3).

2.       Associate: ask the AP for a place on the network.

3.       Security handshake: if the network is WPA2/WPA3, a 4-way handshake sets up the encryption keys.


Wi-Fi reconnect flow · 6 steps


The whole loop runs automatically, which is why your phone simply "comes back" without you doing anything.

What about the disassociation frame?

A common idea is that the device sends a disassociation frame when it leaves, and that this is how it keeps track. But once the device is out of range, that frame can't reach the AP anyway.

Disassociation and DE authentication frames are used when someone leaves on purpose, for example turning off Wi-Fi. When a device simply walks away, both sides find out the other way:

•         The device notices missed beacons and failed ACKs (Step 1).

•         The AP notices the device has gone quiet and removes it after an idle timeout.

Conclusion:

A Wi-Fi device doesn't wait to be told it's disconnected. It watches for missed beacons and unanswered frames, decides the link is lost, then keeps scanning. When it hears its network again, it re-authenticates and re-associates automatically.

 
 
 

Comments


Subscribe Form

Thanks for submitting!

©2020 by Wireless buddies. Proudly created with Wix.com

bottom of page