limelect 48 Posted December 20, 2020 (edited) This project is an Android for network discovery https://github.com/rorist/android-network-discovery It has all devices on the wifi network It seems I do not succeed to duplicate this in Delphi 10.2 FOR A PC Any function will help. Plz EXACT duplicate. Thanks THIS IS FOR MY PC PROGRAM P.S it has my phone my computer and more Edited December 21, 2020 by limelect Share this post Link to post
Dave Nottage 557 Posted December 20, 2020 2 hours ago, limelect said: It seems I do not succeed to duplicate this in Delphi 10.2 What have you tried? Does none of it succeed, or only certain parts? Share this post Link to post
limelect 48 Posted December 20, 2020 (edited) I can put a lot of functions/procedure from the net it will be crazy more than 10 from google search none gave me a LIST with associated software, it will be a few pages. Edited December 20, 2020 by limelect Share this post Link to post
limelect 48 Posted December 20, 2020 Associated to button 1. So many it is usless My-Ip-Scanner-Project-master (2).zip Share this post Link to post
Dave Nottage 557 Posted December 20, 2020 9 hours ago, limelect said: Associated to button 1. So many it is usless Either you posted the wrong source (a VCL app), or your question needs editing. It appears you wanted to replicate some Java code in Delphi. Share this post Link to post
limelect 48 Posted December 21, 2020 @Dave Nottage Sorry to be miss understood. I would like this to be for a PC Share this post Link to post
Angus Robertson 574 Posted December 21, 2020 Why not just use the Nirsoft Wireless Network Watcher tool, it's not really wireless related, just lists details of all LAN IP addresses if finds similarly to your earlier screen shot. It runs 24/7 on my network, it keeps a database of last contact times and names, for phones and NEST devices that only connect periodically. It continually pings all addresses on the LAN, then does reverse DNS lookups, and gets MAC addresses from the Windows ARP table. (probably). Angus Share this post Link to post
limelect 48 Posted December 21, 2020 (edited) @Angus Robertson Let me explain what I want to achieve I would like to press on an IP I receive, In a Delphi program, from my phone and use it in Delphi PC software. That it. I know I can see my IP on my phone, which changes, or, which I do now, use "network discovery". I am trying to add a function/procedure which will be part of a software. P.S maybe I did not write the right words on Google search? Edited December 21, 2020 by limelect Share this post Link to post
Angus Robertson 574 Posted December 21, 2020 Sorry, still not clear. What has a phone got to do with a Windows Delphi application. And what does 'press an IP' mean, What is your business requirement? Angus Share this post Link to post
limelect 48 Posted December 21, 2020 (edited) @Angus Robertson Phone has a lot to do with a PC Communicating to a phone from the PC And if the above Android application dose I want too It discovers MY PC MY PHONE and more on 10..... why can't I do it with Delphi? Edited December 21, 2020 by limelect Share this post Link to post
Angus Robertson 574 Posted December 21, 2020 So you are trying to find the dynamic IP address of a specific device on your LAN? The easiest solution is to avoid dynamic addresses and arrange the DHCP server to allocate a reserved IP address to the phone, that is what I do, although that only works for IPv4. Otherwise you can use the ARP table I mentioned previously to find the LAN IPs and MACs your PC has connected to, but you may need to also ping the IP you expect before anything shows in ARP. the Internet Protocol Helper Component does ARP, ping is available from many places, including ICS. Angus Share this post Link to post
limelect 48 Posted December 21, 2020 (edited) @Angus Rober thanks I will check that info It seems I have what I need on the ARP. But I need the name of the dynamic IP so i will keep checking It is a start Edited December 21, 2020 by limelect Share this post Link to post
aehimself 396 Posted December 22, 2020 For "general discovery" you will need a ping / port scanner. I wrote a fairly simple one a couple of years ago with DNS lookups: However, if you are looking for a specific program, you only need to display hosts where you find your application listening. Share this post Link to post
Angus Robertson 574 Posted December 22, 2020 If you are only looking for your own application running on a phone, an easier solution than ARP or scanning with ping is to use UDP broadcasts in some way, that is how most devices discover each other on a LAN. One device listens on a unique port, and responds with it's IP address and details when it hears a broadcast. Angus 1 Share this post Link to post
limelect 48 Posted December 22, 2020 (edited) Right now NOT very good news with Delphi. My test reference is the above program on my Android s6. As seen it shows a lot of the 10... ip's including my wife's phone, my phone, my PC, and more. As for Delphi. I have used @Angus Robertson suggestion and used "Delphi Developer" in it I took magiphlp30 program and from it I took the ARP part. 1. In the Android program the output is very stable and consistent. I manage to run it on Android Studio and if someone wants the source I will be glad to share it. 2. In the Delphi program the ARP dynamics is VERY unstable giving only a few of the 10... IP's . I also tried to add IP>name without any good results either. So this is where I am P.S in java, the name is taken from "getCanonicalHostName" host.hostname = (InetAddress.getByName(host.ipAddress)).getCanonicalHostName(); Edited December 22, 2020 by limelect Share this post Link to post
limelect 48 Posted December 22, 2020 (edited) 8 hours ago, aehimself said: For "general discovery" you will need a ping / port scanner. I wrote a fairly simple one a couple of years ago with DNS lookups: However, if you are looking for a specific program, you only need to display hosts where you find your application listening. @aehimself This is my own and free quiet extensive http://limelect.com/downloads/my-ip/ with a lot of goodies inside. And with Delphi obviously. Edited December 22, 2020 by limelect Share this post Link to post
Angus Robertson 574 Posted December 22, 2020 APR only shows the IP addresses your PC has attempted to connect to, you also need to ping them or connect with UDP/TCP, then the ARP table will fill up. IP Helper does not have reverse DNS lookup, that is part of all standard internet packages, ICS, Indy, etc, as is ping and open a connection. But you wanted MAC addresses for some reason, and that is what ARP gives you. Angus Share this post Link to post
limelect 48 Posted December 22, 2020 (edited) @Angus Robertson So returning to my basics any suggestions? Can you point me to something specific I can go from here? As you understand I want to duplicate the Android program but with PC Edited December 22, 2020 by limelect Share this post Link to post
Angus Robertson 574 Posted December 22, 2020 I have already given you all the information you need to write such an application. I'm not aware of free source code that you can copy. Angus Share this post Link to post
aehimself 396 Posted December 22, 2020 2 hours ago, limelect said: with a lot of goodies inside. Good for a school project; I don't see any other purpose for applications which - mostly - do things what a built-in Windows command does. If a user doesn't know how to invoke them from the command line they most probably don't need / shouldn't use. 11 hours ago, Angus Robertson said: use UDP broadcasts in some way, that is how most devices discover each other on a LAN. One device listens on a unique port, and responds with it's IP address and details when it hears a broadcast. Even I already used this in one of my applications I completely forgot about this. Yes, for finding your own software on a network segment UDP broadcasting is the way to go. I might be completely wrong on this one, but afaik broadcasts can not be relayed to an other subnet, though. Never tried it and didn't work with broadcasts since, so take this with a grain of salt. Share this post Link to post
Fr0sT.Brutal 900 Posted December 23, 2020 https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol and UPnP Alternatively, "dumb way" - get WiFi adapter IP and scan addresses in its subnet Share this post Link to post