Option values may be structs. Passing them can be complex as it
involves examining your system headers to determine the correct
definition. An example is an ip_mreq, which may be defined in your
system headers as:
struct ip_mreq {
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
In this case #setsockopt could be called like this:
optval = IPAddr.new("224.0.0.251") + Socket::INADDR_ANY
sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, optval)