Advertisement
TAImatem

Untitled

Jun 22nd, 2021
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <KeepAlive/IKeepAliveClient.hpp>
  2. #include <KeepAlive/WSKeepAliveClient.hpp>
  3.  
  4. int main()
  5. {
  6.     boost::asio::io_context ioc;//{ 2 };
  7.     boost::asio::io_context ioc2;
  8.  
  9.     //ssl::context ctx{ ssl::context::sslv23 };
  10.     //auto keepAlive = std::make_shared<KeepAliveClientSecure>(ioc,std::move(ctx));
  11.     auto conf = std::make_shared<JsonReader>("./config/config.json");
  12.     conf->RefreshData();
  13.  
  14.     auto keepAlive = std::make_shared<KeepAliveClient>(conf, std::string("KeepAlive1"), ioc);
  15.     auto keepAlive2 = std::make_shared<KeepAliveClient>(conf, std::string("KeepAlive2"), ioc);
  16.  
  17.     std::string name = "Tester";
  18.     keepAlive->Reconfigure(name);
  19.     std::cout << "Connected to KeepAlive as " << name << std::endl;
  20.     keepAlive2->Reconfigure(name + "2");
  21.     std::cout << "Connected to KeepAlive2 as " << name << std::endl;
  22.     while (1)
  23.     {
  24.         keepAlive->Send();
  25.         keepAlive2->Send();
  26.         std::this_thread::sleep_for(std::chrono::seconds(1));
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement