Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Socket::Option#to_s

sockopt.to_s => string

Alias of #data

returns the socket option data as a string.

Example
p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).data
#=> "\x01\x00\x00\x00"
See also #data #optname #unpack #linger also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0