码迷,mamicode.com
首页 > 其他好文 > 详细

socket中的option

时间:2015-07-11 09:00:34      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:

 

/// Set an option on the socket.
/**
* This function is used to set an option on the socket.
*
* @param option The new option value to be set on the socket.
*
* @throws boost::system::system_error Thrown on failure.
*
* @sa SettableSocketOption @n
* boost::asio::socket_base::broadcast @n
* boost::asio::socket_base::do_not_route @n
* boost::asio::socket_base::keep_alive @n
* boost::asio::socket_base::linger @n
* boost::asio::socket_base::receive_buffer_size @n
* boost::asio::socket_base::receive_low_watermark @n
* boost::asio::socket_base::reuse_address @n
* boost::asio::socket_base::send_buffer_size @n
* boost::asio::socket_base::send_low_watermark @n
* boost::asio::ip::multicast::join_group @n
* boost::asio::ip::multicast::leave_group @n
* boost::asio::ip::multicast::enable_loopback @n
* boost::asio::ip::multicast::outbound_interface @n
* boost::asio::ip::multicast::hops @n
* boost::asio::ip::tcp::no_delay
*
* @par Example
* Setting the IPPROTO_TCP/TCP_NODELAY option:
* @code
* boost::asio::ip::tcp::socket socket(io_service);
* ...
* boost::asio::ip::tcp::no_delay option(true);
* socket.set_option(option);
* @endcode
*/
template <typename SettableSocketOption>
void set_option(const SettableSocketOption& option)
{
boost::system::error_code ec;
this->get_service().set_option(this->get_implementation(), option, ec);
boost::asio::detail::throw_error(ec, "set_option");
}

  

socket中的option

标签:

原文地址:http://www.cnblogs.com/csxy/p/4638009.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!