xtd 0.2.0
Loading...
Searching...
No Matches

◆ ttl() [1/2]

xtd::byte xtd::net::sockets::socket::ttl ( ) const

Gets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket.

Returns
The TTL value.
Exceptions
xtd::net::sockets::socket_exceptionThis option is valid for a datagram socket only.
xtd::object_closed_exceptionThe xtd::net::sockets::socket has been closed.
xtd::not_supported_exceptionhe xtd::net::sockets::socket is not in the xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6 families.
Remarks
The TTL value indicates the maximum number of routers the packet can traverse before the router discards the packet and an Internet Control Message Protocol (ICMP) "TTL exceeded" error message is returned to the sender.
The TTL value may be set to a value from 0 to 255. When this property is not set, the default TTL value for a socket is 32.
Setting this property on a Transmission Control Protocol (TCP) socket is ignored by the TCP/IP stack if a successful connection has been established using the socket.
Note
If you receive a xtd::net::sockets::socket_exception exception, use the xtd::net::sockets::socket_exception::error_code property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.