Boost Asio - Server doesn't receive message

蹲街弑〆低调 提交于 2019-12-06 04:18:19

It does not look like your io_service has any work to do when you invoke run().

bool ServerFramework::Initialize()
{
    mIOService.run(); // <-- you don't check the return value here
    StartAccept();

    return true;
}

it will return the number of handlers executed, I suspect it is zero. Try invoking it after async_accept()

bool ServerFramework::Initialize()
{
    StartAccept();
    mIOService.run();

    return true;
}

Though, it isn't entirely obvious by your limited code snippets where you invoke ServerFramework::Initialize(). I suggest editing your question with a short, self contained, correct example that we can compile with little to no effort. Your current code will not compile without additional boilerplate stuff, like main().

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!