no message
This commit is contained in:
parent
e8ec913705
commit
6cfb31e1b9
@ -170,7 +170,7 @@ void NewMonitorForm::InitWindow()
|
||||
printf("¿ªÆô·þÎñ¶Ë %d \r\n", p->socket_fd);
|
||||
|
||||
auto succ = ::PostMessage(m_parent->GetHWND(),
|
||||
WM_ADD_TCPSERVER_MONITOR, (WPARAM)p, (LPARAM)m_tcp_client);
|
||||
WM_ADD_TCPSERVER_MONITOR, (WPARAM)p, (LPARAM)m_tcp_server);
|
||||
if (!succ) {
|
||||
printf("postmessage error :%d\r\n", GetLastError());
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "tcp_server_form.h"
|
||||
#include "utils.h"
|
||||
|
||||
TcpServerFrom::TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p)
|
||||
{
|
||||
@ -6,7 +7,6 @@ TcpServerFrom::TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpSer
|
||||
m_url = url;
|
||||
m_port = port;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@ TcpServerLibevent* TcpServerFrom::ServerP()
|
||||
void TcpServerFrom::Init()
|
||||
{
|
||||
ui::ChildBox::Init(); // 非常重要,没出事后childbox 后面的FindSubControl无法生效
|
||||
|
||||
|
||||
ui::Label* m_label_1 = dynamic_cast<ui::Label*>(FindSubControl(L"server_info"));
|
||||
ui::RichEdit* m_rich_edit_1 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"server_recv_edit"));
|
||||
ui::RichEdit* m_rich_edit_2 = dynamic_cast<ui::RichEdit*>(FindSubControl(L"lua_script_edit"));
|
||||
@ -34,4 +32,9 @@ void TcpServerFrom::Init()
|
||||
ui::Combo* m_combo_1 = dynamic_cast<ui::Combo*>(FindSubControl(L"clients"));
|
||||
ui::Button* m_button_3 = dynamic_cast<ui::Button*>(FindSubControl(L"btn_do_lua"));
|
||||
|
||||
wchar_t p[200] = L"";
|
||||
wsprintf(p,L"监听地址: %s 端口: %d 在线连接数目: %d",string2wstring(m_url).c_str(),
|
||||
m_port,
|
||||
m_server->ConnectionCount());
|
||||
m_label_1->SetText(p);
|
||||
}
|
||||
|
@ -208,6 +208,8 @@ void ServerCallbacks::server_run(TcpServerLibevent* p) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @param {*}
|
||||
@ -239,6 +241,12 @@ int TcpServerLibevent::RemoveConnection(uint32_t fd) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int TcpServerLibevent::ConnectionCount() {
|
||||
return m_map_client.size();
|
||||
}
|
||||
|
||||
|
||||
int TcpServerLibevent::SetNewConnectionHandle(OnAccept p) {
|
||||
m_handle_accept = p;
|
||||
return 0;
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
int SetNewConnectionHandle(OnAccept);
|
||||
int AddConnection(uint32_t fd, ConnectionLibevent* p);
|
||||
uint64_t SocketFd();
|
||||
int ConnectionCount();
|
||||
friend struct ServerCallbacks;
|
||||
private:
|
||||
uint32_t m_port; // 监听端口号
|
||||
|
Loading…
Reference in New Issue
Block a user