#pragma once #include #include #include #include #include #include #include #pragma comment(lib,"ws2_32.lib") using namespace std; class SocketC { public: struct MsgInfo { int len = 0; //内容长度 char buff[2048] = {0}; //消息内容 }; private: SOCKET sclient = 0; std::listmsgList; BOOL state = 0; std::thread rec; std::mutex msgLock; bool initSocket(); VOID Receive(); public: ~SocketC(); bool Connect(string IP, UINT Prot); int Send(const char* Date, int len); MsgInfo* GetMsg(); void Close(); };