ASIO ip::tcp::iostream and TCP_NODELAY

前端 未结 1 922
执念已碎
执念已碎 2021-01-22 18:30

How do i set TCP_NODELAY option if i use ip::tcp::iostream? I need a socket for this, but i can\'t find how to extract it from iostream.

1条回答
  •  有刺的猬
    2021-01-22 19:00

    use iostream::rdbuf()

    #include 
    
    int
    main()
    {
        boost::asio::ip::tcp::iostream stream;
        const boost::asio::ip::tcp::no_delay option( true );
        stream.rdbuf()->set_option( option );
    }
    

    0 讨论(0)
提交回复
热议问题