KDNSSD 5.109.0
|
Describes a service published over DNS-SD, typically on a remote machine. More...
#include <KDNSSD/RemoteService>
Public Types | |
typedef QExplicitlySharedDataPointer< RemoteService > | Ptr |
![]() | |
typedef QExplicitlySharedDataPointer< ServiceBase > | Ptr |
Signals | |
void | resolved (bool successful) |
Emitted when resolving is complete. | |
Public Member Functions | |
RemoteService (const QString &name, const QString &type, const QString &domain) | |
Creates an unresolved RemoteService representing the service with the given name, type and domain. | |
bool | isResolved () const |
Whether the service has been successfully resolved. | |
bool | resolve () |
Resolves the host name and port of service synchronously. | |
void | resolveAsync () |
Resolves the host name and port of service asynchronously. | |
![]() | |
ServiceBase (const QString &name=QString(), const QString &type=QString(), const QString &domain=QString(), const QString &host=QString(), unsigned short port=0) | |
Creates a ServiceBase object. | |
QString | domain () const |
The domain that the service belongs to. | |
QString | hostName () const |
The hostname of the service. | |
bool | operator!= (const ServiceBase &o) const |
Compares services based on name, type and domain. | |
bool | operator== (const ServiceBase &o) const |
Compares services based on name, type and domain. | |
unsigned short | port () const |
The port number of the service. | |
QString | serviceName () const |
The name of the service. | |
QMap< QString, QByteArray > | textData () const |
Additional text data associated with the service. | |
QString | type () const |
The type of the service. | |
Protected Member Functions | |
void | virtual_hook (int id, void *data) override |
![]() | |
KDNSSD_NO_EXPORT | ServiceBase (ServiceBasePrivate *const d) |
virtual void | virtual_hook (int, void *) |
Additional Inherited Members | |
![]() | |
std::unique_ptr< ServiceBasePrivate > const | d |
Describes a service published over DNS-SD, typically on a remote machine.
This class allows delayed or asynchronous resolution of services. As the name suggests, the service is normally on a remote machine, but the service could just as easily be published on the local machine.
RemoteService instances are normally provided by ServiceBrowser, but can be used to resolve any service if you know the name, type and domain for it.
KDNSSD::RemoteService::RemoteService | ( | const QString & | name, |
const QString & | type, | ||
const QString & | domain | ||
) |
Creates an unresolved RemoteService representing the service with the given name, type and domain.
name | the name of the service |
type | the type of the service (see ServiceBrowser::ServiceBrowser()) |
domain | the domain of the service |
bool KDNSSD::RemoteService::isResolved | ( | ) | const |
Whether the service has been successfully resolved.
true
if hostName() and port() will return valid values, false
otherwise bool KDNSSD::RemoteService::resolve | ( | ) |
Resolves the host name and port of service synchronously.
The host name is not resolved into an IP address - use KResolver for that.
resolved(bool) is emitted before this function is returned.
resolve() will not cause RemoteService to monitor for changes in the hostname or port of the service.
true
if successful, false
on failurevoid KDNSSD::RemoteService::resolveAsync | ( | ) |
Resolves the host name and port of service asynchronously.
The host name is not resolved into an IP address - use KResolver for that.
The resolved(bool) signal will be emitted when the resolution is complete, or when it fails.
Note that resolved(bool) may be emitted before this function returns in case of immediate failure.
RemoteService will keep monitoring the service for changes in hostname and port, and re-emit resolved(bool) when either changes.
|
signal |
Emitted when resolving is complete.
If operating in asynchronous mode this signal can be emitted several times (when the hostName or port of the service changes).
successful | true if the hostName and port were successfully resolved, false otherwise |
|
overrideprotectedvirtual |
Reimplemented from KDNSSD::ServiceBase.