Locate services using Zeroconf with JmDNS on local device AP(hotspot)

network service discovery android example
network service discovery android github
network service discovery windows
nsdserviceinfo
device connection service android
network service discovery ios
jmdns android
what is nsds web app

With my android device set up as a hotspot/Access point(AP), how can I use JmDNS(3.4.0) to find other devices connected to this AP?

Using a regular AP everything works fine when creating the JmDNS instance the normal way;

jmdns = JmDNS.create();

But using my device as an AP this throws exception.

    java.net.SocketException: No such device
    at org.apache.harmony.luni.platform.OSNetworkSystem.setSocketOption(Native Method)
    at dalvik.system.BlockGuard$WrappedNetworkSystem.setSocketOption(BlockGuard.java:382)
    at org.apache.harmony.luni.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:198)
    at org.apache.harmony.luni.net.PlainDatagramSocketImpl.join(PlainDatagramSocketImpl.java:137)
    at java.net.MulticastSocket.joinGroup(MulticastSocket.java:190)
    at javax.jmdns.impl.JmDNSImpl.openMulticastSocket(JmDNSImpl.java:459)
    at javax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:420)
    at javax.jmdns.JmDNS.create(JmDNS.java:60)

I've also tried creating the JmDNS instance with the local IP

jmdns = JmDNS.create( InetAddress.getByName("192.168.1.1") );

which just throws the same exception.

How can I make JmDNS find services connected to the local AP?

It is not possible to use multicast on a local hotspot since it's not possible to acquire the multicast lock. Thus JmDNS will not work.

For anyone else having this problem, the alternative solution of finding connected devices I ended up using is based on parsing /proc/net/arp

Recently Active 'jmdns' Questions, JmDNS is a Java implementation of multi-cast DNS and can be used for service Locate services using Zeroconf with JmDNS on local device AP(hotspot). I am having an iot device which is advertising in my network with name iotdevice.local, i am able to send http requests to this domain in my windows pc after installing Bonjour.

This is now possible (since API 16) with a help of Android Network Service Discovery (NSD). NSD supports phone as hotspot/AP as well as regular AP connections (i.e. connection to a router). So you don't need JmDns anymore to achieve your goal. See: https://developer.android.com/training/connect-devices-wirelessly/nsd

ZeroConf by vstirbu, Locate services using Zeroconf with JmDNS on local device AP(hotspot); iPad stops responding to bonjour/zeroconf after name change  Typically, the best way to find the IP addresses of all devices on a network is to invest in software. This is especially true for large organizations using dynamic IP addresses, in which case the large volume of networked devices and staggered address changes can quickly become overwhelming to track and organize.

I don't think this directly answers your question, but I found that unless I have active wifi jmDNS won't work. I had to disable discovery if my wifi is off.

Zeroconf by onovotny, Locate services using Zeroconf with JmDNS on local device AP(hotspot); iPad stops responding to bonjour/zeroconf after name change  Find Devices Connected to WiFi Network : Device Informations. So you can Find Devices Connected to WiFi Network in following ways:-#1 Glass Wire Pro Glass Wire has a big fan following because of its firewalls and security system. With its pro version, you can have the quick and easy view of devices connected to your Wi-Fi network.

Use network service discovery, Network service discovery (NSD) gives your app access to services that other devices provide on a local network. Devices that support NSD  You are in the same room as the device. If you're using an iOS device, turn on Bluetooth On the Home screen, tap Settings Bluetooth. Make sure the slider is On (toggled to the right and green). Close out of Settings and return to the Google Home app . If you're using an Android device, turn on Location services. On your Android device, tap

Android wifi library github, Ayanda is meant to detect nearby devices using WiFi and Bluetooth technology. In general, it It seems that people have troubles using dns-sd/zeroconf/bonjour on Android An OPEN SOURCE library which allows you to connect to Wi-Fi hotspots. In The Google Play Services version of the Places SDK for Android (i. Bonjour is Apple's implementation of Zero Configuration Networking (Zeroconf), and allows browsing, connecting to and advertising a LAN service. That means ftp servers, iTunes sharing, printers or custom services can be browsed and connected to without any kind of IP or port input from the end user.

how to search for all devices in local network? · Issue #70 · balthazar , I am using this line of code. scan(type = 'http', protocol = 'tcp', domain NSNetService doesn't have option to search for all types of services. domain = '​local'; const zeroconf = new Zeroconf(); zeroconf.on('start', Last time I had to pull in jmDNS and RxDNSSD, and later found out that the test device  gmxc -p $(pgrep mdns-publisher) mdns | sort mdns.connector.questions: 3 mdns.connector.responses: 3 mdns.zone.local.entries: 5 mdns.zone.local.queries: 12 Changelog. 12/02/2012. Simplified mdns.Publish method, thanks to Miek Gieben for his quick work adding parsing support for SRV and PTR records. 07/02/2012. Updated LICENCE to a proper BSD 2

Comments
  • Is there no name server on that AP?
  • To clearify, the AP is a hotspot set up on the device I'm running the application on. And I want to find other services connected to this device/AP. It's sort of a workaround for the lack of AdHoc support on android.
  • @Pterus did you manage to get round this?
  • No, my current opinion is that it isn't possible. I implemented an alternative procedure of finding clients using ping and arp-lookup by parsing the /proc/net/arp file. It works surprisingly well!
  • I have obtained multicast lock android 4.4.2 using android.net.wifi.WifiManager, the lock.isHeld() returns true but jmDNS throws the same exception. Any idea what could be the problem?
  • Hi can you share the implementation of the alternate way that you came up with?
  • When I try to read the file /proc/net/arp in my android 10 device after requesting storage permissions it says permission denied and filenotfounderror I think it requires root access?
  • @PhaniRithvij I'm sorry, this was 8 years ago. I'm afraid things might have changed since then. Android security model is completely different now. And I dont think I have access to that piece of code I wrote anymore. The file might not be three on android 10, or maybe it has moved, I dont know. Good luck.