IP_TTL(2const) IP_TTL(2const)

IP_TTL - time to live

Standard C library (libc-lc)

#include <netinet/in.h>  /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_TTL,
               const int *ttl, sizeof(int));
int getsockopt(int sockfd, IPPROTO_IP, IP_TTL,
               int *ttl, sizeof(int));

Set or retrieve the current time-to-live field that is used in every packet sent from this socket.

See IPPROTO_IP(2const). See setsockopt(2). See ip(7).

Linux 1.0.

IPPROTO_IP(2const), setsockopt(2), ip(7)

2025-11-25 Linux man-pages 6.17