From 15084716e8e9b8037a40df3f395c45b22ee19185 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Mon, 13 Sep 2021 00:27:40 +0800 Subject: [PATCH] no message --- protoDebuger/sharedata.cpp | 6 ++++++ protoDebuger/sharedata.h | 1 + protoDebuger/tcp_server_libevent.cpp | 4 ++-- protoDebuger/tcp_server_libevent.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/protoDebuger/sharedata.cpp b/protoDebuger/sharedata.cpp index 4aebad8..a2ae9c7 100644 --- a/protoDebuger/sharedata.cpp +++ b/protoDebuger/sharedata.cpp @@ -112,6 +112,7 @@ int QmlShareData::openNetwork(QString ip, unsigned int port, bool is_ws,int type m_tcp_server->moveToThread(this->thread()); connect(m_tcp_server,SIGNAL(on_onnected(string , uint )),this,SLOT(on_network_conected(string , uint )),Qt::DirectConnection); connect(m_tcp_server,SIGNAL(on_disconected(string , uint )),this,SLOT(on_network_disconected(string , uint )),Qt::DirectConnection); + connect(m_tcp_server,SIGNAL(on_conn_read(string )),this,SLOT(on_network_server_read(string)),Qt::DirectConnection); return 0; } @@ -226,6 +227,11 @@ void QmlShareData::on_udp_data_recv(){ } } +void QmlShareData::on_network_server_read(string ip) +{ + qDebug()<Server(); + emit(server->on_conn_read("12345")); cout << "client " << conn->IpAddress() << " say:" << buf << endl; conn->OnRecv(buf,sizeof(buf)); } @@ -359,5 +360,4 @@ TcpServerLibevent::~TcpServerLibevent(){ delete m_event_listener; m_event_listener = nullptr; } - } diff --git a/protoDebuger/tcp_server_libevent.h b/protoDebuger/tcp_server_libevent.h index 98e464f..6ba7b6e 100644 --- a/protoDebuger/tcp_server_libevent.h +++ b/protoDebuger/tcp_server_libevent.h @@ -115,6 +115,7 @@ public: signals: int on_onnected(string ip,uint sock); int on_disconected(string ip,uint sock); + int on_conn_read(string ip); #endif private: