DataBuriedPoint.h 807 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <WinSock.h>
  3. #include <iostream>
  4. #pragma comment(lib, "ws2_32.lib")
  5. #include <json/reader.h>
  6. class HttpRequest
  7. {
  8. public:
  9. HttpRequest(const std::string& ip, int port);
  10. ~HttpRequest(void);
  11. std::string HttpPost(std::string req, std::string data);
  12. private:
  13. std::string RequesStr(std::string req, std::string data);
  14. private:
  15. SOCKET CreateSocket();
  16. void CloseSocket();
  17. int ConnectSocket(SOCKET socket, std::string ip);
  18. int SendData(SOCKET socket, std::string strSend);
  19. private:
  20. std::string m_ip;
  21. int m_port;
  22. };
  23. //Âñµã
  24. class BuriedPos
  25. {
  26. public:
  27. BuriedPos();
  28. BuriedPos(const std::string& ip, int port);
  29. ~BuriedPos(void);
  30. void SendBury(std::string key,std::string content);
  31. private:
  32. HttpRequest* request;
  33. void CreateJson();
  34. };