문제

Forgive me my bad English. I just started using qjsonrpc, and I like this thing. But recently I encountered a problem when using QJsonRpcTcpServer in my application: how can I keep track of a client connect/disconnect?

도움이 되었습니까?

해결책

It seems you need to pass a QJsonRpcTcpServerPrivate instance to the QJsonRpcTcpServer::QJsonRpcTcpServer ctor, so I'd just subclass QJsonRpcTcpServerPrivate and override the following methods:

  • void QJsonRpcTcpServerPrivate::_q_processIncomingConnection()
  • void QJsonRpcTcpServerPrivate::_q_clientDisconnected()

github://devonit/qjsonrpc/src/qjsonrpctcpserver.cpp

You could then do something like casting the tcpSocket* to an appropriately long integer type and use that as the key to some dictionary/map.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top