开发者

boost::asio checker

try
  {
    boost::asio::io_service io_service;

    tcp::acceptor acceptor(io_service, tcp::开发者_如何学Cendpoint(tcp::v4(), 13));

    for (;;)
    {
      tcp::socket socket(io_service);
      acceptor.accept(socket);
     //how do i make a checker here if the client is not sending anything then server send or if the client sending then server recive 
    }
  }
  catch (std::exception& e)
  {
    std::cerr << e.what() << std::endl;
  }

how do i make a checker, if the client is not sending anything then server send or if the client sending then server recive


The question is not immediately clear.

I would start an async_read() with an associated deadline_timer set to an appropriate value. If your timer expires before any reading was performed, then have your server send its data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜