Android Question [B4X] Find all reachable ips in the local network - GetHostName trouble. How to get MacAddress?

Elric

Well-Known Member
Licensed User
Hello everyone!

I've started from here: https://www.b4x.com/android/forum/threads/b4x-find-all-reachable-ips-in-the-local-network.166100/.

I've made the project herein attached to include both the code by Erel in the first post and the code by LucaMs in the last post.

I'm just able to get the hostname of the router (www.adsl.sc... so weird) and of my laptop. I also try different unsuccessful ways that I decided not to add in the project.

Do I need to conclude it is not possible to get the hostname of other device? It seems so strange to me.

Any hint?

there is a way to get also the MacAddress?

Thanks as usual!

NB: tested both B4A and B4J. Even if this is the log in B4J, under B4A I've got same results.
Logs:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
SUB ScanNetwork by Erel started
GetHostName = false
192.168.1.10,
192.168.1.1,
192.168.1.2,
192.168.1.7,
192.168.1.4,
192.168.1.5,
192.168.1.3,
done
SUB ScanNetwork by Erel ended
SUB ScanAllNetwork by LucaMs + ChatGPT started
🔍 Starting full network scan...
🌐 Scanning IP: 192.168.1.10 (Interface: wlan1)
📡 Subnet: 192.168.1.
GetHostName = false
✅ All subnet scans completed.
SUB ScanAllNetwork by LucaMs + ChatGPT ended
🟢 Reachable: 192.168.1.10 -
🟢 Reachable: 192.168.1.1 -
🟢 Reachable: 192.168.1.2 -
🟢 Reachable: 192.168.1.3 -
🟢 Reachable: 192.168.1.4 -
🟢 Reachable: 192.168.1.7 -
🟢 Reachable: 192.168.1.5 -
done
SUB ScanNetwork by Erel started
GetHostName = true
192.168.1.10, LAPTOP-E1SOQGMH.station
192.168.1.1, www.adsl.sc
192.168.1.2, 192.168.1.2
192.168.1.3, 192.168.1.3
192.168.1.5, 192.168.1.5
192.168.1.7, 192.168.1.7
192.168.1.4, 192.168.1.4
done
SUB ScanNetwork by Erel ended
SUB ScanAllNetwork by LucaMs + ChatGPT started
🔍 Starting full network scan...
🌐 Scanning IP: 192.168.1.10 (Interface: wlan1)
📡 Subnet: 192.168.1.
GetHostName = true
✅ All subnet scans completed.
SUB ScanAllNetwork by LucaMs + ChatGPT ended
🟢 Reachable: 192.168.1.10 - LAPTOP-E1SOQGMH.station
🟢 Reachable: 192.168.1.1 - www.adsl.sc
🟢 Reachable: 192.168.1.2 - 192.168.1.2
🟢 Reachable: 192.168.1.3 - 192.168.1.3
🟢 Reachable: 192.168.1.4 - 192.168.1.4
🟢 Reachable: 192.168.1.7 - 192.168.1.7
done
 

Attachments

  • ScanNetwork.zip
    16.5 KB · Views: 61
Top