Home · Modules · Classes · Namespaces · Functions

QxtDiscoverableService Class Reference
[QxtZeroconf module]

The QxtDiscoverableService class registers a service that can be discovered with Zeroconf, or resolve such a service More...

    #include <QxtDiscoverableService>

Inherits QObject.

Public Types

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QxtDiscoverableService class registers a service that can be discovered with Zeroconf, or resolve such a service

QxtDiscoverableService represents a service on the local network that can be discovered using Zeroconf. It can function to provide such a service so that other systems on the network can find it, or it can resolve the connection parameters for a service provided by another system on the network. Note that resolving a service requires that you already know the service name in addition to the service type for the remote service; to find all services on the network that offer a given service type, use QxtServiceBrowser.

When registering a service, you may specify a set of service subtypes to indicate what kind of optional capabilities your service offers. Other applications browsing for discoverable services (for instance, using QxtServiceBrowser) can limit their search to only those services that provide a given subtype. Use the properties inherited from QxtDiscoverableServiceName to configure the other service parameters.

For more information about Zeroconf, see the documentation available on www.zeroconf.org.

See also QxtDiscoverableServiceName and QxtServiceBrowser.


Member Type Documentation

enum QxtDiscoverableService::ErrorCode

enum QxtDiscoverableService::ServiceFlag
flags QxtDiscoverableService::ServiceFlags

The ServiceFlags type is a typedef for QFlags<ServiceFlag>. It stores an OR combination of ServiceFlag values.

enum QxtDiscoverableService::State


Member Function Documentation

QxtDiscoverableService::QxtDiscoverableService ( const QString & serviceType, QObject * parent = 0 )

Constructs a QxtDiscoverableService object using the specified service type.

The service type may be a plain type name or it may be provided in the standard format specified by the Zeroconf specification.

The service name will be automatically generated based on the system's hostname.

QxtDiscoverableService::QxtDiscoverableService ( const QString & serviceType, const QString & serviceName, QObject * parent = 0 )

Constructs a QxtDiscoverableService object using the specified service type.

The service type may be a plain type name or it may be provided in the standard format specified by the Zeroconf specification.

If the specified service name is already in use, it will be updated with a number to make it unique.

QxtDiscoverableService::~QxtDiscoverableService ()   [virtual]

Destroys the QxtDiscoverableService.

TIf registered, the service will be unregistered.

void QxtDiscoverableService::addServiceSubType ( const QString & subtype )

Adds a subtype to the service.

See also serviceSubTypes, setServiceSubTypes, removeServiceSubType, and hasServiceSubType.

bool QxtDiscoverableService::hasServiceSubType ( const QString & subtype )

Tests to see if the specified service is available and known for the service.

When discovering a service, only subtypes that were included in the service discovery request will be available.

See also serviceSubTypes, setServiceSubTypes, addServiceSubType, and removeServiceSubType.

quint16 QxtDiscoverableService::port () const

Returns the port number used for connecting to the service.

See also setPort.

void QxtDiscoverableService::registerService ( bool noAutoRename = false )

Attempts to register the service on the local network.

If noAutoRename is set to true, registration will fail if another service of the same service type is already registered with the same service name. Otherwise, the service name will be updated with a number to make it unique.

See also registered and registrationError.

void QxtDiscoverableService::registered ()   [signal]

void QxtDiscoverableService::registrationError ( int code )   [signal]

void QxtDiscoverableService::releaseService ()

Releases the service.

If the service is registered, it will be unregistered. Any outstanding resolve attempt will be aborted.

void QxtDiscoverableService::removeServiceSubType ( const QString & subtype )

Removes a subtype from the service.

See also serviceSubTypes, setServiceSubTypes, addServiceSubType, and hasServiceSubType.

void QxtDiscoverableService::resolve ( bool forceMulticast = false )

Attempts to resolve the service in order to determine the host and port necessary to establish a connection.

If forceMulticast is set to true, QxtDiscoverableService will use a multicast request to resolve the service, even if the host name appears to be a unicast address (that is, outside the local network).

See also resolved and resolveError.

void QxtDiscoverableService::resolveError ( int code )   [signal]

void QxtDiscoverableService::resolved ( const QByteArray & domainName )   [signal]

QStringList QxtDiscoverableService::serviceSubTypes () const

Returns a list of all subtypes known for the service.

When discovering a service, only subtypes that were included in the service discovery request will be included in this list.

See also setServiceSubTypes, addServiceSubType, removeServiceSubType, and hasServiceSubType.

void QxtDiscoverableService::setPort ( quint16 port )

Sets the port number used for connecting to the service.

When registering a service with a port number of 0 (the default), the service will not be found when browsing, but the service name will be marked as reserved.

Setting the port is only meaningful when registering a service.

See also port.

void QxtDiscoverableService::setServiceSubTypes ( const QStringList & subtypes )

Sets the list of subtypes for this service.

See also serviceSubTypes, addServiceSubType, removeServiceSubType, and hasServiceSubType.

State QxtDiscoverableService::state () const

Returns the current state of the service.


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1