try
{
boost::asio::io_service io_service;
tcp::acceptor acceptor(io_service, tcp::endpoint(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;
}
我如何做一个检查器,如果客户端没有发送任何东西然后服务器发送或者如果客户端发送然后服务器接收
最佳答案
问题不是很清楚。
我会启动一个 async_read()
并将关联的 deadline_timer
设置为适当的值。如果您的计时器在执行任何读取之前到期,则让您的服务器发送其数据。
关于c++ - boost::asio 检查器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6048197/