Hi,
I am implementing 'Local fortune server' example (from Qt 4.7.3) as a service on Windows.
What i want is that when someone paused the service, the local server should notify the error to the connected local socket (local fortune client). The error can be QLocalSocket::ServerNotFoundError.
Now, How to generate this error from server example. Please look at the following code where i want to generate this error.
void FortuneServer::incomingConnection(quintptr socketDescriptor)
{
if (disabled) {
[B]// here i want to emit QLocalSocket::ServerNotFoundError [/B]
return;
}
QString fortune
= fortunes.
at(qrand
() % fortunes.
size());
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
void FortuneServer:: pause()
{
disabled = true;
}
void FortuneServer::incomingConnection(quintptr socketDescriptor)
{
if (disabled) {
[B]// here i want to emit QLocalSocket::ServerNotFoundError [/B]
return;
}
QString fortune = fortunes.at(qrand() % fortunes.size());
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
void FortuneServer:: pause()
{
disabled = true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks