instance method
UNIXServer#accept
() -> ::UNIXSocket
unixserver.accept => unixsocket
ext/socket/unixserver.c
View on GitHub ↗
static VALUE
unix_accept(VALUE server)
{
struct sockaddr_un buffer;
socklen_t length = sizeof(buffer);
return rsock_s_accept(rb_cUNIXSocket, server, (struct sockaddr*)&buffer, &length);
}
Accepts an incoming connection. It returns a new UNIXSocket object.
Example
UNIXServer.open("/tmp/sock") {|serv| UNIXSocket.open("/tmp/sock") {|c| s = serv.accept s.puts "hi" s.close p c.read #=> "hi\n" } }