#include <publicservice.h>
Signals | |
void | published (bool) |
Public Member Functions | |
PublicService (const TQString &name=TQString::null, const TQString &type=TQString::null, unsigned int port=0, const TQString &domain=TQString::null) | |
void | stop () |
bool | publish () |
bool | isPublished () const |
void | publishAsync () |
void | setTextData (const TQMap< TQString, TQString > &textData) |
void | setServiceName (const TQString &serviceName) |
void | setType (const TQString &type) |
void | setPort (unsigned short port) |
void | setDomain (const TQString &domain) |
const KURL | toInvitation (const TQString &host=TQString::null) |
Public Member Functions inherited from DNSSD::ServiceBase | |
ServiceBase (const TQString &name=TQString::null, const TQString &type=TQString::null, const TQString &domain=TQString::null, const TQString &host=TQString::null, unsigned short port=0) | |
const TQString & | serviceName () const |
const TQString & | type () const |
const TQString & | domain () const |
const TQString & | hostName () const |
unsigned short | port () const |
const TQMap< TQString, TQString > & | textData () const |
Protected Member Functions | |
virtual void | customEvent (TQCustomEvent *event) |
virtual void | virtual_hook (int, void *) |
Protected Member Functions inherited from DNSSD::ServiceBase | |
TQString | encode () |
void | decode (const TQString &name) |
Additional Inherited Members | |
Public Types inherited from DNSSD::ServiceBase | |
typedef TDESharedPtr< ServiceBase > | Ptr |
Protected Attributes inherited from DNSSD::ServiceBase | |
TQString | m_serviceName |
TQString | m_type |
TQString | m_domain |
TQString | m_hostName |
unsigned short | m_port |
TQMap< TQString, TQString > | m_textData |
Detailed Description
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:
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:
This class represents local service being published
Definition at line 61 of file publicservice.h.
Constructor & Destructor Documentation
◆ PublicService()
DNSSD::PublicService::PublicService | ( | const TQString & | name = TQString::null , |
const TQString & | type = TQString::null , |
||
unsigned int | port = 0 , |
||
const TQString & | domain = TQString::null |
||
) |
- Parameters
-
name Service name. If set to TQString::null, 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 TQString:null, user configuration will be used. "local." means local LAN
Definition at line 77 of file publicservice.cpp.
Member Function Documentation
◆ isPublished()
bool DNSSD::PublicService::isPublished | ( | ) | const |
Returns true is currently published.
Definition at line 167 of file publicservice.cpp.
◆ publish()
bool DNSSD::PublicService::publish | ( | ) |
Synchrounous publish.
Application will be freezed until publishing is complete.
- Returns
- true if successfull.
Definition at line 172 of file publicservice.cpp.
◆ publishAsync()
void DNSSD::PublicService::publishAsync | ( | ) |
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.
Definition at line 237 of file publicservice.cpp.
◆ published
|
signal |
Emitted when publishing is complete - parameter is set to true if it was successfull.
It will also emitted when name, port or type of already published service is changed.
◆ setDomain()
void DNSSD::PublicService::setDomain | ( | const TQString & | domain | ) |
Sets domain where service is published.
"local." means local LAN. If service is currently published, it will be re-announced with new data.
Definition at line 122 of file publicservice.cpp.
◆ setPort()
void DNSSD::PublicService::setPort | ( | unsigned short | port | ) |
Sets port.
If service is currently published, it will be re-announced with new data.
Definition at line 145 of file publicservice.cpp.
◆ setServiceName()
void DNSSD::PublicService::setServiceName | ( | const TQString & | serviceName | ) |
Sets name of the service.
If service is currently published, it will be re-announced with new data.
Definition at line 111 of file publicservice.cpp.
◆ setTextData()
void DNSSD::PublicService::setTextData | ( | const TQMap< TQString, TQString > & | textData | ) |
Sets new text properties.
If services is already published, it will be re-announced with new data.
Definition at line 156 of file publicservice.cpp.
◆ setType()
void DNSSD::PublicService::setType | ( | const TQString & | 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.
Definition at line 134 of file publicservice.cpp.
◆ stop()
void DNSSD::PublicService::stop | ( | ) |
Stops publishing or abort incomplete publish request.
Useful when you want to disable service for some time.
Definition at line 179 of file publicservice.cpp.
◆ toInvitation()
const KURL DNSSD::PublicService::toInvitation | ( | const TQString & | host = TQString::null | ) |
Translates service into URL that can be sent to another user.
- Parameters
-
host Use specified hostname. If left empty, public IP address (the one used for default route) will be used.
- Since
- 3.5
Definition at line 265 of file publicservice.cpp.
The documentation for this class was generated from the following files: