Skip to content

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

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>
See also #int .byte .ipv4_multicast_loop .bool also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0