Boost.Asio( Boost SVN), boost::asio::detail::socket_option, boost/asio/socket_base.hpp :
typedef boost::asio::detail::socket_option::timeval<SOL_SOCKET, SO_SNDTIMEO>
send_timeout;
typedef boost::asio::detail::socket_option::timeval<SOL_SOCKET, SO_RCVTIMEO>
receive_timeout;
(, timeval boost::asio::detail::socket_option, , .: -P)
: socket_option::timeval socket_option::integer:
template <int Level, int Name>
class timeval
{
public:
timeval()
: value_(zero_timeval())
{
}
explicit timeval(::timeval v)
: value_(v)
{
}
timeval& operator=(::timeval v)
{
value_ = v;
return *this;
}
::timeval value() const
{
return value_;
}
template <typename Protocol>
int level(const Protocol&) const
{
return Level;
}
template <typename Protocol>
int name(const Protocol&) const
{
return Name;
}
template <typename Protocol>
::timeval* data(const Protocol&)
{
return &value_;
}
template <typename Protocol>
const ::timeval* data(const Protocol&) const
{
return &value_;
}
template <typename Protocol>
std::size_t size(const Protocol&) const
{
return sizeof(value_);
}
template <typename Protocol>
void resize(const Protocol&, std::size_t s)
{
if (s != sizeof(value_))
throw std::length_error("timeval socket option resize");
}
private:
static ::timeval zero_timeval()
{
::timeval result = {};
return result;
}
::timeval value_;
};