Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Socket::AncillaryData#cmsg_is?

ancillarydata.cmsg_is?(level, type) => true or false

tests the level and type of ancillarydata.

Example
ancdata = Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
ancdata.cmsg_is?(Socket::IPPROTO_IPV6, Socket::IPV6_PKTINFO) #=> true
ancdata.cmsg_is?(:IPV6, :PKTINFO)       #=> true
ancdata.cmsg_is?(:IP, :PKTINFO)         #=> false
ancdata.cmsg_is?(:SOCKET, :RIGHTS)      #=> false
See also .unix_rights #data .new #family also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1