Method: Socket::Option#ipv4_multicast_loop

Defined in:
option.c

#ipv4_multicast_loopInteger

Returns the ipv4_multicast_loop data in sockopt as an integer.

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

Returns:

  • (Integer)


414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'option.c', line 414

static VALUE
sockopt_ipv4_multicast_loop(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_LOOP)
    if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_LOOP) {
        return XCAT(sockopt_,TYPE_IP_MULTICAST_LOOP)(self);
    }
#endif
    rb_raise(rb_eTypeError, "ipv4_multicast_loop socket option expected");
    UNREACHABLE_RETURN(Qnil);
}