End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
UNIXServer#sysaccept
unixserver.sysaccept => file_descriptor
ext/socket/unixserver.c
View on GitHub ↗
static VALUE
unix_sysaccept(VALUE server)
{
struct sockaddr_un buffer;
socklen_t length = sizeof(buffer);
return rsock_s_accept(0, server, (struct sockaddr*)&buffer, &length);
}
Accepts a new connection. It returns the new file descriptor which is an integer.
Example
UNIXServer.open("/tmp/sock") {|serv| UNIXSocket.open("/tmp/sock") {|c| fd = serv.sysaccept s = IO.new(fd) s.puts "hi" s.close p c.read #=> "hi\n" } }