Skip to content

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

instance method

BasicSocket#recvmsg_nonblock

(?::Integer dlen, ?::Integer flags, ?::Integer clen, ?exception: ::boolish, ?scm_rights: ::boolish) -> ([ ::String, ::Addrinfo, ::Integer?, ::Array[::Socket::AncillaryData] ] | :wait_readable)
basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls]

recvmsg receives a message using recvmsg(2) system call in non-blocking manner.

It is similar to BasicSocket#recvmsg but non-blocking flag is set before the system call and it doesn’t retry the system call.

By specifying a keyword argument exception to false, you can indicate that recvmsg_nonblock should not raise an IO::WaitReadable exception, but return the symbol :wait_readable instead.

See also #recvmsg #recv_nonblock #recv #remote_address also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0