#pragma once #include #include #include #include #include #include #include "md5.h" #include "AES.h" #pragma comment(lib,"ws2_32.lib") using namespace std; class SocketC { private: struct MsgHead { int isStr = 0; int bufLen = 0; time_t tm = 0; char token[34] = { 0 }; }; char tmpBuf[10240] = { 0 }; int bufLen = 0; SOCKET sclient = 0; BOOL state = 0; std::thread rec; std::mutex msgLock; function Rfunc = NULL; function Cfunc = NULL; bool initSocket(); VOID Receive(); char* RecvBuff(char* buf, int& len, int& isStr); public: SocketC(int bufSize = 4096, int modo = 0); ~SocketC(); bool Connect(string IP, UINT Prot); int SendData(const char* Date, int len, int isStr = 0); BOOL SendStr(string str); VOID SetRecvFunc(function fun); VOID SetCloseFunc(function fun); void Close(); };