1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/qqtnetworkexample/qqtuserprotocol2.cpp

27 lines
718 B
C++
Raw Normal View History

2018-04-19 23:03:39 +08:00
#include "qqtuserprotocol2.h"
QDebug& operator << ( QDebug& dbg, const QQtUserMessage2& msg )
{
//这里打印一下,报文里面到底有什么信息,
//一般到这里的都是被解析好的message。
dbg.nospace() << "{" << hex << msg.size() << "}";
return dbg.space();
}
QQtUserProtocol2* QQtUserConnectionInstance2 ( QObject* parent )
{
static QQtUserProtocol2* p0 = NULL;
2018-04-22 13:03:28 +08:00
static QQtTcpClient* s0 = NULL;
2018-04-19 23:03:39 +08:00
if ( !p0 && !s0 )
{
p0 = new QQtUserProtocol2 ( parent );
2018-04-22 13:03:28 +08:00
s0 = new QQtTcpClient ( parent );
2018-04-19 23:03:39 +08:00
s0->installProtocol ( p0 );
s0->connectToHost ( QHostAddress ( "192.168.0.100" ), 8000 );
}
return p0;
}