.TH "DNSSD::PublicService" kde3 "11 Jun 2005" "Version Version 3.4.1" "dnssd Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
DNSSD::PublicService \- This class is most important for application that wants to announce its service on network. This class represents local service being published.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <publicservice.h>\fP
.PP
Inherits \fBQObject\fP, and \fBDNSSD::ServiceBase\fP.
.PP
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBpublished\fP (bool)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBPublicService\fP (const \fBQString\fP &\fBname\fP=QString::null, const \fBQString\fP &type=QString::null, unsigned int port=0, const \fBQString\fP &domain=QString::null)"
.br
.ti -1c
.RI "void \fBstop\fP ()"
.br
.ti -1c
.RI "bool \fBpublish\fP ()"
.br
.ti -1c
.RI "bool \fBisPublished\fP () const "
.br
.ti -1c
.RI "void \fBpublishAsync\fP ()"
.br
.ti -1c
.RI "void \fBsetTextData\fP (const \fBQMap\fP< \fBQString\fP, \fBQString\fP > &textData)"
.br
.ti -1c
.RI "void \fBsetServiceName\fP (const \fBQString\fP &serviceName)"
.br
.ti -1c
.RI "void \fBsetType\fP (const \fBQString\fP &type)"
.br
.ti -1c
.RI "void \fBsetPort\fP (unsigned short port)"
.br
.ti -1c
.RI "void \fBsetDomain\fP (const \fBQString\fP &domain)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBcustomEvent\fP (\fBQCustomEvent\fP *\fBevent\fP)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int, void *)"
.br
.in -1c
.SH "Detailed Description"
.PP 
This class is most important for application that wants to announce its service on network. This class represents local service being published. 

Suppose that you want to make your web server public - this is simplest way:
.PP
.PP
.nf
DNSSD::PublicService *service = new DNSSD::PublicService('My files','_http._tcp',80);
bool isOK = service->publish();
.fi
.PP
.PP
In this example \fBpublish()\fP 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:
.PP
.PP
.nf
DNSSD::PublicService *service = new DNSSD::PublicService('My files','_http._tcp',80);
connect(service,SIGNAL(published(bool)),this,SLOT(wasPublished(bool)));
service->publishAsync();
.fi
.PP
.PP
\fBAuthor:\fP
.RS 4
Jakub Stachowski 
.RE
.PP

.PP
Definition at line 55 of file publicservice.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "DNSSD::PublicService::PublicService (const \fBQString\fP & name = \fCQString::null\fP, const \fBQString\fP & type = \fCQString::null\fP, unsigned int port = \fC0\fP, const \fBQString\fP & domain = \fCQString::null\fP)"
.PP
\fBParameters:\fP
.RS 4
\fIname\fP Service name. If set to QString::null, computer name will be used and will be available via \fBserviceName()\fP after successful registration 
.br
\fItype\fP Service type. Has to be in form _sometype._udp or _sometype._tcp 
.br
\fIport\fP Port number. Set to 0 to 'reserve' service name. 
.br
\fIdomain\fP Domain name. If left as \fBQString\fP:null, user configuration will be used. 'local.' means local LAN
.RE
.PP

.PP
Definition at line 47 of file publicservice.cpp.
.PP
References QString::isNull().
.SH "Member Function Documentation"
.PP 
.SS "void DNSSD::PublicService::stop ()"
.PP
Stops publishing or abort incomplete publish request. 
.PP
Useful when you want to disable service for some time.
.PP
Definition at line 122 of file publicservice.cpp.
.PP
Referenced by publishAsync(), setDomain(), setPort(), setServiceName(), setTextData(), and setType().
.SS "bool DNSSD::PublicService::publish ()"
.PP
Synchrounous publish. 
.PP
Application will be freezed until publishing is complete. 
.PP
\fBReturns:\fP
.RS 4
true if successfull.
.RE
.PP

.PP
Definition at line 115 of file publicservice.cpp.
.PP
References publishAsync().
.SS "bool DNSSD::PublicService::isPublished () const"
.PP
Returns true is currently published. 
.PP
Definition at line 101 of file publicservice.cpp.
.SS "void DNSSD::PublicService::publishAsync ()"
.PP
Asynchronous version of \fBpublish()\fP. 
.PP
It return immediately and emits signal \fBpublished(bool)\fP when completed. Note that in case of early detected error (like bad service type) signal may be emitted before return of this function.
.PP
Definition at line 128 of file publicservice.cpp.
.PP
References QString::ascii(), QMap::begin(), QMap::end(), QCString::length(), published(), stop(), and QString::utf8().
.PP
Referenced by publish(), setDomain(), setPort(), setServiceName(), setTextData(), and setType().
.SS "void DNSSD::PublicService::setTextData (const \fBQMap\fP< \fBQString\fP, \fBQString\fP > & textData)"
.PP
Sets new text properties. 
.PP
If services is already published, it will be re-announced with new data.
.PP
Definition at line 106 of file publicservice.cpp.
.PP
References publishAsync(), and stop().
.SS "void DNSSD::PublicService::setServiceName (const \fBQString\fP & serviceName)"
.PP
Sets name of the service. 
.PP
If service is currently published, it will be re-announced with new data.
.PP
Definition at line 64 of file publicservice.cpp.
.PP
References publishAsync(), and stop().
.SS "void DNSSD::PublicService::setType (const \fBQString\fP & type)"
.PP
Sets type of service. 
.PP
It has to in form of _type._udp or _type._tcp. If service is currently published, it will be re-announced with new data.
.PP
Definition at line 83 of file publicservice.cpp.
.PP
References publishAsync(), and stop().
.SS "void DNSSD::PublicService::setPort (unsigned short port)"
.PP
Sets port. 
.PP
If service is currently published, it will be re-announced with new data.
.PP
Definition at line 92 of file publicservice.cpp.
.PP
References publishAsync(), and stop().
.SS "void DNSSD::PublicService::setDomain (const \fBQString\fP & domain)"
.PP
Sets domain where service is published. 
.PP
'local.' means local LAN. If service is currently published, it will be re-announced with new data.
.PP
Definition at line 73 of file publicservice.cpp.
.PP
References publishAsync(), and stop().
.SS "void DNSSD::PublicService::published (bool)\fC [signal]\fP"
.PP
Emitted when publishing is complete - parameter is set to true if it was successfull. 
.PP
It will also emitted when name, port or type of already published service is changed.
.PP
Referenced by publishAsync().

.SH "Author"
.PP 
Generated automatically by Doxygen for dnssd Library from the source code.
