ASIO ip :: tcp :: iostream和TCP_NODELAY [英] ASIO ip::tcp::iostream and TCP_NODELAY
本文介绍了ASIO ip :: tcp :: iostream和TCP_NODELAY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我使用ip :: tcp :: iostream,如何设置TCP_NODELAY选项?我需要一个套接字,但我找不到如何从iostream中提取它。
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.
推荐答案
#include <boost/asio.hpp>
int
main()
{
boost::asio::ip::tcp::iostream stream;
const boost::asio::ip::tcp::no_delay option( true );
stream.rdbuf()->set_option( option );
}
这篇关于ASIO ip :: tcp :: iostream和TCP_NODELAY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文