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

28 lines
719 B
C++
Raw Normal View History

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