Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
method dgram.Socket.prototype.setTTL
import { dgram } from "https://deno.land/x/tellojs@v1.0.2/src/deps.ts";
const { Socket } = dgram;

Sets the IP_TTL socket option. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a packet is allowed to travel through. Each router or gateway that forwards a packet decrements the TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. Changing TTL values is typically done for network probes or when multicasting.

The ttl argument may be between between 1 and 255. The default on most systems is 64.

This method throws EBADF if called on an unbound socket.

Parameters

ttl: number