EntglDb nodes automatically discover each other on the local network using UDP Broadcast/Multicast. Each node periodically announces its presence via a "Beacon".
| Parameter | Value | Description |
|---|---|---|
| UDP Port | 25000 |
Port used for sending and receiving beacons |
| Interval | 5000 ms |
Time between beacon broadcasts |
| Expiry | 15000 ms |
Time after which a silent peer is considered offline |
| Group Address | 255.255.255.255 |
Fallback broadcast address (primary is subnet-specific) |
The payload is a UTF-8 JSON string.
{
"node_id": "string (UUID or unique identifier)",
"tcp_port": number (integer, typically 25000)
}Currently implicit. Future versions may add a version field.
-
Start-up:
- Bind a
DatagramSocketto UDP Port25000. - Enable
SO_BROADCAST. - Start a background listener loop.
- Bind a
-
Announce (Broadcast):
- Every
5000 ms: - Construct the JSON beacon.
- Calculate the subnet broadcast address (e.g.,
192.168.1.255). - Send the UDP packet to the calculated address on port
25000. - Optional: Also send to
255.255.255.255as a fallback.
- Every
-
Listen (Receive):
- Receive incoming UDP packets on port
25000. - Parse the JSON payload.
- Ignore beacons from own
node_id. - Update the "Last Seen" timestamp for the peer in the internal
PeerTable. - If the peer is new, attempt a TCP Handshake (see Protocol Spec) to synchronization.
- Receive incoming UDP packets on port
- Source Port: Must originate from port
25000to satisfy some firewall configurations (optional but recommended). - Android: Requires
WifiManagerto calculate the correct broadcast address.