PublicService Class Reference
from PyKDE4.dnssd import *
Inherits: QObject,DNSSD.ServiceBase
Namespace: DNSSD
Detailed Description
\class PublicService publicservice.h DNSSD/PublicService
This class is most important for application that wants to announce its service on network. Suppose that you want to make your web server public - this is simplest way:
DNSSD.PublicService *service = new DNSSD.PublicService("My files","_http._tcp",80); bool isOK = service->publish();
In this example publish() is synchronous - it will not return until publishing is complete. This is usually not too long but it can freeze application's GUI for a moment. Asynchronous publishing is better for responsiveness. Example:
DNSSD.PublicService *service = new DNSSD.PublicService("My files","_http._tcp",80); connect(service,SIGNAL(published(bool)),this,SLOT(wasPublished(bool))); service->publishAsync();
This class represents local service being published
Signals | |
published (bool a0) | |
Methods | |
__init__ (self, QString name=QString(), QString type=QString(), long port=0, QString domain=QString(), QStringList subtypes=QStringList()) | |
bool | isPublished (self) |
bool | publish (self) |
publishAsync (self) | |
published (self, bool a0) | |
setDomain (self, QString domain) | |
setPort (self, long port) | |
setServiceName (self, QString serviceName) | |
setSubTypes (self, QStringList subtypes) | |
setTextData (self, QMap | |
setType (self, QString type) | |
stop (self) | |
QStringList | subtypes (self) |
virtual_hook (self, int a0, void a1) |
Method Documentation
__init__ | ( | self, | ||
QString | name=QString(), | |||
QString | type=QString(), | |||
long | port=0, | |||
QString | domain=QString(), | |||
QStringList | subtypes=QStringList() | |||
) |
- Parameters:
-
name Service name. If set to QString(), computer name will be used and will be available via serviceName() after successful registration type Service type. Has to be in form _sometype._udp or _sometype._tcp port Port number. Set to 0 to "reserve" service name. domain Domain name. If left as QString:null, user configuration will be used. "local." means local LAN subtypes Optional list of subtypes. Each subtype name must have leading underscore. Example: service of type _ftp._tcp may have subtype _anon meaning that it is anonymous FTP server.
bool isPublished | ( | self ) |
Returns true is currently published
bool publish | ( | self ) |
Synchrounous publish. Application will be freezed until publishing is complete.
- Returns:
- true if successful.
publishAsync | ( | self ) |
Asynchronous version of publish(). It return immediately and emits signal published(bool) when completed. Note that in case of early detected error (like bad service type) signal may be emitted before return of this function.
published | ( | self, | ||
bool | a0 | |||
) |
Emitted when publishing is complete - parameter is set to true if it was successful. It will also emitted when name, port or type of already published service is changed.
- Signal syntax:
QObject.connect(source, SIGNAL("published(bool)"), target_slot)
setDomain | ( | self, | ||
QString | domain | |||
) |
Sets domain where service is published. "local." means local LAN. If service is currently published, it will be re-announced with new data.
setPort | ( | self, | ||
long | port | |||
) |
Sets port. If service is currently published, it will be re-announced with new data.
setServiceName | ( | self, | ||
QString | serviceName | |||
) |
Sets name of the service. If service is currently published, it will be re-announced with new data.
setSubTypes | ( | self, | ||
QStringList | subtypes | |||
) |
Sets subtypetypes of service. Pass empty list to remove subtype. If service is currently published, it will be re-announced with new data.
setTextData | ( | self, | ||
QMap |
textData | |||
) |
Sets new text properties. If services is already published, it will be re-announced with new data.
setType | ( | self, | ||
QString | type | |||
) |
Sets type of service. It has to in form of _type._udp or _type._tcp. If service is currently published, it will be re-announced with new data.
stop | ( | self ) |
Stops publishing or abort incomplete publish request. Useful when you want to disable service for some time.
QStringList subtypes | ( | self ) |
Returns otpional subtype of service. It is always empty for domains and in most cases empty for normal services.
virtual_hook | ( | self, | ||
int | a0, | |||
void | a1 | |||
) |