Advertisement
Panakotta00

Discord_Client.h

Sep 12th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #ifndef DISCORD_CLIENT_H
  2. #define DISCORD_CLIENT_H
  3.  
  4. #pragma once
  5.  
  6. #include <iostream> /* std::cout, std::cerr, std::endl */
  7. #include <string> /* std::string */
  8. #include <functional>
  9. #include <map>
  10. #include <vector>
  11. #include <cstdlib> /* exit */
  12. #include <cstdio> /* perror */
  13. #include <cstring> /* memcpy, memset */
  14.  
  15. #ifdef _WIN32
  16. #include <process.h>
  17. #include "AllowWindowsPlatformTypes.h"
  18. #include <winsock2.h>
  19. #include "HideWindowsPlatformTypes.h"
  20. #else
  21. #include <sys/socket.h>
  22. #include <sys/types.h>
  23. #include <netinet/in.h>
  24. #include <arpa/inet.h>
  25. #include <netdb.h>
  26. #include <unistd.h>
  27. #endif
  28.  
  29. using namespace std;
  30.  
  31. class Discord_Client {
  32. public:
  33.     Discord_Client(int PORT, char *HOST);
  34.     ~Discord_Client();
  35.     void discord_connect();
  36.     void discord_disconnect();
  37.     string discord_get(string msg);
  38.     void discord_send(const char *msg);
  39. private:
  40.     static const int MAX_LINE = 1024;
  41.     int PORT;
  42.     char *HOST;
  43.     #ifdef _WIN32
  44.     SOCKET sockfd;
  45.     #else
  46.     pthread_t thread;
  47.     int sockfd;
  48.     #endif
  49. };
  50.  
  51. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement