Method: Socket::Option#ipv4_multicast_ttl

Defined in:
option.c

#ipv4_multicast_ttlInteger

Returns the ipv4_multicast_ttl data in sockopt as an integer.

sockopt = Socket::Option.ipv4_multicast_ttl(10)
p sockopt.ipv4_multicast_ttl => 10

Returns:

  • (Integer)


465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'option.c', line 465

static VALUE
sockopt_ipv4_multicast_ttl(VALUE self)
{
    int family = NUM2INT(sockopt_family_m(self));
    int level = sockopt_level(self);
    int optname = sockopt_optname(self);

#if defined(IPPROTO_IP) && defined(IP_MULTICAST_TTL)
    if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_TTL) {
        return XCAT(sockopt_,TYPE_IP_MULTICAST_TTL)(self);
    }
#endif
    rb_raise(rb_eTypeError, "ipv4_multicast_ttl socket option expected");
    UNREACHABLE_RETURN(Qnil);
}