IP_TTL(2const)

IP_TTL2const

Time to live

Usage

#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));

Library

Standard C library (libc, -lc)

Overview

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

Errors

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

History

Linux 1.0.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.