no message

This commit is contained in:
zcy 2022-01-05 01:41:58 +08:00
parent 771e4a8684
commit 12b3047006
3 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@ TcpServerFrom::TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpSer
m_url = url;
m_port = port;
}
@ -38,3 +39,9 @@ void TcpServerFrom::Init()
m_server->ConnectionCount());
m_label_1->SetText(p);
}
ConnectionLibevent* TcpServerFrom::OnNewConnAccept(bufferevent* ev, uint32_t fd, sockaddr_in* p1)
{
return nullptr;
}

View File

@ -16,6 +16,8 @@ public:
TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p);
TcpServerLibevent* ServerP();
virtual void Init() override;
protected:
ConnectionLibevent* OnNewConnAccept(struct bufferevent* ev, uint32_t fd, struct sockaddr_in* p1);
private:
TcpServerLibevent* m_server;

View File

@ -62,6 +62,8 @@ class TcpServerLibevent {
}SERVER_STATUS;
public:
typedef std::function<ConnectionLibevent* (struct bufferevent* ev, uint32_t fd, struct sockaddr_in* p1)> OnAccept;
typedef std::function<void (ConnectionLibevent*)> OnDisconnect;
TcpServerLibevent(int port, string bindip);
SERVER_STATUS Status();
~TcpServerLibevent();
@ -85,6 +87,7 @@ private:
thread* m_thread;
map<uint32_t, ConnectionLibevent*> m_map_client;
OnAccept m_handle_accept;
OnDisconnect m_handle_disconnect;
intptr_t mSocketFD; // 操作系统原生socket
};