QDnsServiceRecord Class

The QDnsServiceRecord class stores information about a DNS SRV record. More...

Header: #include <QDnsServiceRecord>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network

Public Functions

QDnsServiceRecord(const QDnsServiceRecord &other)
QString name() const
quint16 port() const
quint16 priority() const
void swap(QDnsServiceRecord &other)
QString target() const
quint32 timeToLive() const
quint16 weight() const
QDnsServiceRecord &operator=(const QDnsServiceRecord &other)

Detailed Description

When performing a lookup on a service, zero or more records will be returned. Each record is represented by a QDnsServiceRecord instance.

The meaning of the fields is defined in RFC 2782.

See also QDnsLookup.

Member Function Documentation


Constructs an empty service record object.

QDnsServiceRecord::QDnsServiceRecord(const QDnsServiceRecord &other)

Constructs a copy of other.


Destroys a service record.

QString QDnsServiceRecord::name() const

Returns the name for this record.

quint16 QDnsServiceRecord::port() const

Returns the port on the target host for this service record.

quint16 QDnsServiceRecord::priority() const

Returns the priority for this service record.

A client must attempt to contact the target host with the lowest-numbered priority.

void QDnsServiceRecord::swap(QDnsServiceRecord &other)

Swaps this service record instance with other. This function is very fast and never fails.

QString QDnsServiceRecord::target() const

Returns the domain name of the target host for this service record.

quint32 QDnsServiceRecord::timeToLive() const

Returns the duration in seconds for which this record is valid.

quint16 QDnsServiceRecord::weight() const

Returns the weight for this service record.

The weight field specifies a relative weight for entries with the same priority. Entries with higher weights should be selected with a higher probability.

QDnsServiceRecord &QDnsServiceRecord::operator=(const QDnsServiceRecord &other)

Assigns the data of the other object to this record object, and returns a reference to it.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.