Node Discovery and Pycom
pycom's discovery mechanism works the same way regardless of the network topology.
How it works
pycom continuously scans the entire /24 subnet every 5 seconds, iterating over all 254 possible host addresses in the last octet. For each address it attempts a TCP connection on port 5000 with a short timeout. If the connection succeeds, pycom sends its own node information to that address — this is how it announces itself to your application.
Scanning continues until a coordinator node is found. Your application does not need to be running when LA4 boots; it will be discovered on the next scan cycle whenever it starts listening on port 5000.
Heartbeats and stale nodes
Once a node is discovered, pycom maintains the connection with periodic heartbeats sent every 3 seconds. If a node stops responding for more than 15 seconds it is considered stale and removed from the active node list. It will be re-discovered automatically on the next successful scan.
Scanning for an LA4 from your application
If you want your PC application to find the LA4 proactively — rather than waiting for pycom to discover you — the right approach depends on how the LA4 obtained its IP address.
Static IP
In a point-to-point setup, the LA4 is configured with the static IP address 192.168.0.23, so there is nothing to discover. The application can connect directly to that address on port 5000 and identify itself as the coordinator immediately.
Dynamic IP (DHCP)
In a star topology, when the LA4 receives its address from a DHCP server the IP may change between power cycles. In this case the application can mirror what pycom does internally: present the available IPv4 network interfaces to the user, derive the /24 subnet prefix from whichever interface shares a network with the LA4, then probe all 254 host addresses on port 5000 concurrently with a short timeout. Any address that accepts the connection is a pycom node. Once found, the application opens a persistent connection and identifies itself as the coordinator, causing pycom to switch to passive mode.
Pycom passive mode
When pycom discovers a node that has flagged itself as a coordinator (typically your PC application), it switches to passive mode — it stops scanning the network and instead sends heartbeats only to the coordinator. This reduces network traffic and switches from a 1-to-many connection attempts to a 1-to-1.
If the coordinator becomes unreachable and is removed as stale, pycom returns to active scanning mode until a new coordinator is found.