Skip to content

PythonQt.Qt.QDnsLookup

QDnsLookup

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QDnsLookup uses the mechanisms provided by the operating system to perform DNS lookups. To perform a lookup you need to specify a name and type then invoke the lookup() slot. The finished() signal will be emitted upon completion.

For example, you can determine which servers an XMPP chat client should connect to for a given domain with:

void MyObject::lookupServers()
{
    // Create a DNS lookup.
    dns = new QDnsLookup(this);
    connect(dns, SIGNAL(finished()),
            this, SLOT(handleServers()));

    // Find the XMPP servers for gmail.com
    dns->setType(QDnsLookup::SRV);
    dns->setName("_xmpp-client._tcp.gmail.com");
    dns->lookup();
}

Once the request finishes you can handle the results with:

void MyObject::handleServers()
{
    // Check the lookup succeeded.
    if (dns->error() != QDnsLookup::NoError) {
        qWarning("DNS lookup failed");
        dns->deleteLater();
        return;
    }

    // Handle the results.
    const auto records = dns->serviceRecords();
    for (const QDnsServiceRecord &record : records) {
        ...
    }
    dns->deleteLater();
}

Note: If you simply want to find the IP address(es) associated with a host name, or the host name associated with an IP address you should use QHostInfo instead.

Source: https://doc.qt.io/archives/qt-5.15/qdnslookup.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
A attribute Any (shared captured text)
AAAA attribute Any (shared captured text)
ANY attribute Any (shared captured text)
CNAME attribute Any (shared captured text)
Error attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
InvalidReplyError attribute Any (shared captured text)
InvalidRequestError attribute Any (shared captured text)
MX attribute Any (shared captured text)
NS attribute Any (shared captured text)
NoError attribute Any (shared captured text)
NotFoundError attribute Any (shared captured text)
OperationCancelledError attribute Any (shared captured text)
PTR attribute Any (shared captured text)
ResolverError attribute Any (shared captured text)
SRV attribute Any (shared captured text)
ServerFailureError attribute Any (shared captured text)
ServerRefusedError attribute Any (shared captured text)
TXT attribute Any (shared captured text)
Type attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
abort function (self) -> None Aborts the DNS lookup operation. (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
canonicalNameRecords function (self) -> tuple X.canonicalNameRecords() -> tuple (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.destroyed; argument details are not documented.
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
error attribute Any This property holds the type of error that occurred if the DNS lookup failed, or [NoError](https://doc.qt.io/archives/qt-5.15/qdnslookup.html#Error-enum). (shared captured text)
errorString attribute str This property holds a human-readable description of the error if the DNS lookup failed. (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
finished function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.finished; argument details are not documented.
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hostAddressRecords function (self) -> tuple X.hostAddressRecords() -> tuple (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isFinished function (self) -> bool X.isFinished() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
lookup function (self) -> None Performs the DNS lookup. (shared captured text)
mailExchangeRecords function (self) -> tuple X.mailExchangeRecords() -> tuple (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
name attribute str This property holds the name to lookup. (shared captured text)
nameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.nameChanged; argument details are not documented.
nameServerRecords function (self) -> tuple X.nameServerRecords() -> tuple (shared captured text)
nameserver attribute QHostAddress This property holds the nameserver to use for DNS lookup. (shared captured text)
nameserverChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.nameserverChanged; argument details are not documented.
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
pointerRecords function (self) -> tuple X.pointerRecords() -> tuple (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
serviceRecords function (self) -> tuple X.serviceRecords() -> tuple (shared captured text)
setName function (self, name: str) -> None (shared captured text)
setNameserver function (self, nameserver: Any) -> None (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setType function (self, arg__1: Any) -> None (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
textRecords function (self) -> tuple X.textRecords() -> tuple (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
type attribute Any This property holds the type of DNS lookup. (shared captured text)
typeChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QDnsLookup.typeChanged; argument details are not documented.