I'm using QnetworkAccessManager to make the HTTP request, I want to know when the FQDN is resolved(DNS resolution) to get the IP address or list of IP addresses.
How QNetworkAccessManager selects the IP from the list of resolved IPs to send the request?
Do QNetworkAccessManager keep the cache of DNS resolution?
QNetworkAccessManager
uses QAbstractSocket
including its ability to resolve host names. QAbstractSocket
uses QHostInfo::lookupHost
to get list of IPs (QHostInfo::addresses
) of specified host. QAbstractSocket
tries to connect to each of QHostInfo::addresses
until connection is succeeded.
There is no way to know which address was used because QNetworkAccessManager
doesn't expose used sockets to the user. You can get full list of addresses using QHostInfo
public API.
QHostInfo
has internal global cache which stores up to 128 items with max age of 1 minute.