Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Built a Mesh Network That Works When the Internet Doesn't

What happens when the power grid fails? When cellular towers collapse? When the internet simply disappears? You get silence. Isolation. No way to call for help. I built OEMN (Offline Emergency Mesh Network) to answer this: What if your laptop could become part of an automatic emergency communication system, no infrastructure required? THE PROBLEM: CONNECTIVITY DOESN'T SCALE During the…

A mesh network is designed to provide connectivity during extreme circumstances when traditional infrastructure fails. The Offline Emergency Mesh Network (OEMN) aims to create an automatic emergency communication system that doesn't rely on existing infrastructure. During natural disasters such as the Turkey-Syria earthquakes of February 2023, communication networks collapsed, making it difficult for people to reach out for help.

The problem with traditional connectivity is that it is fragile and centralized, leading to a cascading failure if even one link breaks. OEMN solves this by enabling laptops, phones, and devices to communicate with each other directly, forming their own network on-the-fly. However, building a mesh network is not as simple as it seems, as there are three layers of hard problems to overcome.

The first problem is how nodes find each other, which requires a way for node A to say "I exist" and have node B hear it. The second problem is how to route messages efficiently in a mesh of nodes, which requires topology awareness and the ability to recompute optimal routes in real-time. The third problem is how to guarantee delivery of messages, which involves using protocols like UDP with reliability mechanisms like ACKs, retries, deduplication, encryption, and replay protection.

OEMN's architecture consists of four threads, each with a single responsibility: Listener Thread, Router Thread, Send Queue, and Sender Thread. These threads communicate through a shared send queue, ensuring thread safety by design. When a packet arrives, the Listener Thread validates encryption and checks replay protection. If the packet is for the sender, it enqueues it for the Sender Thread to transmit and wait for confirmation.

If no ACK is received within a timeout, the Sender Thread retries with exponential backoff. The routing table maps destinations to next hops and distances in hops, enabling automatic failover to alternate paths when a node fails. With its elegant simplicity and robust design, OEMN offers a reliable solution for emergency communication when traditional infrastructure fails.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Sunday 23 August →