Код: Выделить всё
socket->async_wait(ip::tcp::socket::wait_read, [=](const boost::system::error_code& ec)
{
std::size_t avail = socket->available();
auto buf = std::make_unique(avail);
int length = recv(socket->native_handle(), buf.get(), avail, MSG_PEEK);
// now buffer contains possible ClientHello message
});
Подробнее здесь: https://stackoverflow.com/questions/797 ... lly-or-not
Мобильная версия