2018-04-19 23:03:39 +08:00
|
|
|
|
#include "qqtuserprotocol.h"
|
|
|
|
|
|
|
|
|
|
QDebug& operator << ( QDebug& dbg, const QQtUserMessage& msg )
|
|
|
|
|
{
|
|
|
|
|
//这里打印一下,报文里面到底有什么信息,
|
|
|
|
|
//一般到这里的,都是被解析好的message。
|
|
|
|
|
|
|
|
|
|
dbg.nospace() << "{" << hex << msg.size() << "}";
|
|
|
|
|
return dbg.space();
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-29 20:05:46 +08:00
|
|
|
|
QQtTcpClient* QQtUserInstance ( QQtUserProtocol*& protocol, QObject* parent )
|
2018-04-19 23:03:39 +08:00
|
|
|
|
{
|
|
|
|
|
static QQtUserProtocol* p0 = NULL;
|
2018-04-23 10:00:09 +08:00
|
|
|
|
if ( !p0 )
|
2018-04-19 23:03:39 +08:00
|
|
|
|
{
|
|
|
|
|
p0 = new QQtUserProtocol ( parent );
|
2018-04-23 10:00:09 +08:00
|
|
|
|
}
|
2018-04-29 20:05:46 +08:00
|
|
|
|
protocol = p0;
|
2018-04-23 10:00:09 +08:00
|
|
|
|
|
2018-04-29 20:05:46 +08:00
|
|
|
|
static QQtTcpClient* s0 = NULL;
|
2018-04-23 10:00:09 +08:00
|
|
|
|
if ( !s0 )
|
|
|
|
|
{
|
2018-04-29 20:05:46 +08:00
|
|
|
|
s0 = new QQtTcpClient ( parent );
|
|
|
|
|
s0->installProtocol ( p0 );
|
|
|
|
|
//s0->setServer
|
|
|
|
|
//s0->sendConnectToHost();
|
2018-04-19 23:03:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-29 20:05:46 +08:00
|
|
|
|
return s0;
|
2018-04-19 23:03:39 +08:00
|
|
|
|
}
|