boost::asio - Clarification on binding to a specific network interface

≯℡__Kan透↙ 提交于 2019-12-04 07:11:05

You can bind to a specific endpoint using the appropriate tcp::ip::acceptor constructor

include <boost/asio.hpp>

int
main()
{
    using namespace boost::asio;
    io_service service;
    ip::tcp::endpoint ep(
            ip::address::from_string( "127.0.0.1" ),
            1234
            );
    ip::tcp::acceptor acceptor( 
            service,
            ep
            );
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!