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.
精彩评论