Reachability on local network

I'm looking for a way to monitor if a device is reachable on the local WLAN network using its IP address (for example 192.168.1.101 ). I already tried the Network Reachability API without success (I don't get any update even when disconnecting the device from the network).

The idea is to be informed when this IP address got reachable/unreachable to inform the user of this event.

Any idea how to get it working? Or is Reachability not the right tool for this?

"Reachability" usually means determining if the device you are running on has internet connectivity (either through WiFi or cellular network). It doesn't mean being whether or not you can make a connection from one device on a local network to another device on the same network.

I would think Bonjour or something like that would be more what you are looking for.

1 Like

As @ehyche said, Bonjour would be a good candidate to find devices on a local network, as would Apple-specific frameworks like MultipeerConnectivity. I don’t know how frequently those APIs remove devices from the list, however, so you may be best served by implementing a ping-like feature in your code that attempts to establish a connection with the device at periodic intervals. Perhaps combining the two; Bonjour to discover devices and then ping to discover when they go offline.

1 Like

Many thanks for your help!

I'll dig into Bonjour and custom ping timer.

On the apple side (including Bonjour), you might be interested in this WWDC–Advances in Networking, Part 2

1 Like
Terms of Service

Privacy Policy

Cookie Policy