Some details of using QHostInfo::lookupHost
-
Hi!
I want to know how to check IP or DNS I set is ok. But I have some questions aboutlookupHost()
.- If I set
QHostInfo::lookupHost("192.168.1.1",this, SLOT(receiver())
, does it run continuously or just check once? - If I set as follows ,will they interfere each other?
QHostInfo::lookupHost("192.168.1.1",this, SLOT(receiver1()); QHostInfo::lookupHost("192.168.1.2",this, SLOT(receiver2());
- How about check DNS is ok if in local area network?
e.g.QHostInfo::lookupHost("8.8.8.8",this, SLOT(receiver2())
.
Regards.
Mihan - If I set
-
Hi,
-
AFAIK, it will search once. It would not make sense to spam a DNS with the same query continuously.
-
No, they will not interfere. Note that the order in which you will ge the results is not guaranteed. See the method documentation.
-
I'm not sure I'm following you on that one.
-
-
Thanks @SGaist
Normally, If I close the DHCP, I must set IP, gateway, netmask and DNS so that machine can go online, rigth?
So The third question is that if the IP is rigth but the DNS is wrong, can it detect?
e.g.
IP: 192.168.1.1 (√)
DNS: 8.8.7.8 (not exist)
then I useQHostInfo::lookupHost("8.8.7.8",this, SLOT(receiver2())
, can it return the error.BTY, If I want to make a real time check for the local area network, must I make a timer to run this function? Or you can give me some suggest, thank you.
Regards
Mihan -
@Mihan said in Some details of using QHostInfo::lookupHost:
then I use QHostInfo::lookupHost("8.8.7.8",this, SLOT(receiver2()), can it return the error.
Have you checked the code snippet from QHostInfo::lookupHost() documentation?
You have an example there how to check for error...