asio C++ library

PrevUpHomeNext

ip::unicast::hops

Socket option for time-to-live associated with outgoing unicast packets.

typedef implementation_defined hops;

Implements the IPPROTO_IP/IP_UNICAST_TTL socket option.

Examples

Setting the option:

asio::ip::udp::socket socket(my_context);
...
asio::ip::unicast::hops option(4);
socket.set_option(option);

Getting the current option value:

asio::ip::udp::socket socket(my_context);
...
asio::ip::unicast::hops option;
socket.get_option(option);
int ttl = option.value();
Requirements

Header: asio/ip/unicast.hpp

Convenience header: asio.hpp


PrevUpHomeNext