SHARE
TWEET

Untitled

a guest Jan 20th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2.  
  3. #include "scorpio/network.hpp"
  4.  
  5. class AndroidHandler: public MsgHandlerBase
  6. {
  7. public:
  8.     explicit AndroidHandler()
  9.     :   MsgHandlerBase("drive")
  10.     {}
  11.  
  12.     void handle(const nlohmann::json& msg, const int& grantorSocket) const override
  13.     {
  14.         const auto sMsg = msg.dump();
  15.         const char* csMsg = sMsg.c_str();
  16.         printf("%s mati to cwel\n", csMsg);
  17.     }
  18. };
  19.  
  20. auto main(int argc, char** argv) -> int
  21. {
  22.     auto handler = std::make_unique<AndroidHandler>();
  23.     std::vector<std::unique_ptr<MsgHandlerBase>> handlers;
  24.     handlers.push_back(std::move(handler));
  25.  
  26.     tcp::Server server(5000, std::move(handlers));
  27.     server.work();
  28.  
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top