Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Socket::Option.int
Socket::Option.int(family, level, optname, integer) => sockopt
ext/socket/option.c
View on GitHub ↗
static VALUE
sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint)
{
int family = rsock_family_arg(vfamily);
int level = rsock_level_arg(family, vlevel);
int optname = rsock_optname_arg(family, level, voptname);
return rsock_sockopt_new(family, level, optname, sockopt_pack_int(vint));
}
Creates a new Socket::Option object which contains an int as data.
The size and endian is dependent on the platform.
Example
p Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1) #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>