# Method Stdio.UDP()->set_multicast_ttl()

Method set_multicast_ttl

  `int set_multicast_ttl(int ttl)`

Description

  Set the time-to-live value of outgoing multicast packets for this socket.

Parameter `ttl`

  The number of router hops sent multicast packets should survive.

  It is very important for multicast packets to set the smallest TTL possible. The default before calling this function is 1 which means that multicast packets don't leak from the local network unless the user program explicitly requests it.

  See also the Unix man page for setsocketopt IPPROTO_IP IP_MULTICAST_TTL and IPPROTO_IPV6 IPV6_MULTICAST_HOPS.

Note

  This function did not support IPv6 in Pike 7.8 and earlier.

See also

  add_membership()