Windows에서 서비스로 '로컬 포춘 서버'예제 (Qt 4.7.3)를 구현 중입니다. 내가 원하는 것은 누군가가 서비스를 일시 정지 시켰을 때, 로컬 서버는 연결된 로컬 소켓 (로컬 포춘 클라이언트)에 오류를 알려야한다는 것입니다. 오류는 QLocalSocket :: ServerNotFoundError가 될 수 있습니다. 지금,이 오류를 서버 예제에서 생성하는 방법. 이 오류를 생성하려는 다음 코드를 확인하십시오.QLocalSocket에 대한 오류 발생 방법
void FortuneServer::incomingConnection(quintptr socketDescriptor)
{
if (disabled) {
**// here i want to emit QLocalSocket::ServerNotFoundError**
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;
}
을 그것은 영어로 나쁜 문법입니다. 그것은 "QLocalSocket에 대한 오류를 어떻게 내야합니까?"입니다. – CodeLurker