本文整理汇总了C++中boost::asio::ip::tcp::socket::set_option方法的典型用法代码示例。如果您正苦于以下问题:C++ socket::set_option方法的具体用法?C++ socket::set_option怎么用?C++ socket::set_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::asio::ip::tcp::socket
的用法示例。
在下文中一共展示了socket::set_option方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: socket_options
void socket_options(boost::asio::ip::tcp::socket &socket) {
boost::system::error_code ignored;
socket.non_blocking(non_blocking_io);
socket.set_option(linger, ignored);
if (receive_buffer_size) socket.set_option(*receive_buffer_size, ignored);
if (receive_low_watermark)
socket.set_option(*receive_low_watermark, ignored);
if (send_buffer_size) socket.set_option(*send_buffer_size, ignored);
if (send_low_watermark) socket.set_option(*send_low_watermark, ignored);
}
示例2: setupSocket
void TCPClient::setupSocket(boost::asio::ip::tcp::socket& socket)
{
if (!_setup_socket)
{
_setup_socket = true;
socket.set_option(boost::asio::ip::tcp::no_delay(true));
}
}
示例3:
void applySocketOpts(boost::system::error_code& set_option_err)
{
socket.set_option(boost::asio::ip::tcp::no_delay(true), set_option_err);
if (set_option_err){
//std::cerr << "socket.set_option => " << set_option_err.message() << std::endl;
LOG_ERR << "socket.set_option => " << set_option_err.message();
}
/*
socket.set_option( boost::asio::socketbase::send_buffer_size( 65536 ) ,set_option_err);
if(set_option_err){
std::cerr <<"socket.set_option => " << set_option_err.message() <<std::endl;
}
socket.set_option( boost::asio::socketbase::receive_buffer_size( 65536 ),set_option_err );
if(set_option_err){
std::cerr <<"socket.set_option => " << set_option_err.message() <<std::endl;
}
*/
}
示例4: OnSocketInit
void Server::OnSocketInit(ConnectionHandle connection, boost::asio::ip::tcp::socket& s)
{
// Disable Nagle's algorithm from each connection to avoid delays in sync
boost::asio::ip::tcp::no_delay option(true);
s.set_option(option);
}
示例5: on_socket_init
void on_socket_init(websocketpp::connection_hdl hdl, boost::asio::ip::tcp::socket & s) {
boost::asio::ip::tcp::no_delay option(true);
s.set_option(option);
}
示例6: onSocketInit
void Webserver::onSocketInit(connection_hdl hdl, boost::asio::ip::tcp::socket &s) {
boost::asio::ip::tcp::no_delay option(true);
s.set_option(option);
}