[Solved] An IP address is connected or not
-
Hi friend.
I want to find all ip addresses that are connected (in LAN).
I used lookupHost() function explained in this link:
http://qt-project.org/doc/qt-4.8/qhostinfo.html#lookupHostBut my application says "Found address:" for all ip addresses!
I glad to hear your ideas.Thanks a lot.
Ya Ali. -
Hi, you can use ping 192.168.1.1, 192.168.1.2 and so on but it's not 100% because of firewalls, or for a printer or an iPhone because they're sleeping (i.e. an iPhone only answers to ping when the display is lit, unless it has power connected).
Same as for your other question, using the ARP protocol is probably best.
Also you can download the nmap tool. -
Hi again & thank a million. :)
In the link that I`ve mentioned in my first post, There is an example.
I replace the QHostInfo::HostNotFound instead of QHostInfo::NoError, but did not work.Your ideas about ping is very nice, but my applicaion have to be cross-platform with minimum changing of code.
-
Glad to help!
About why QHostinfo::HostNotFound doesn't work, I think it works but only when you try a DNS name, like www.google.com. I.e. a number like 192.168.61.111 is always "found".About crossplatform: you can look at that network scanning utility I mentioned before "nmap":http://nmap.org/download.html it comes with source code.
-
QHostinfo::HostNotFound doesn’t work even for www.google.com.
qDebuge results:
Lookup failed: "Unknown error"You`re right. nmap is a good idea for cross-platform application.
English language is not my main language. I dont know which phrase means thank you very very much. But I say thank you very very much. :)Solved!
-
Hello again to all,
I created a dll to find all online IP addresses and their MAC addresses in the LAN. Share with you:
I wrote an article about this topic and posted in CodeProject:
http://www.codeproject.com/Articles/798730/Finding-All-Online-IP-Addresses-Simple-Method