A local interprocess communication server socket.
Only available on UNIX and UNIX-like operating systems.
Example usage:
require "socket" def handle_client(client) message = client.gets client.puts message end server = UNIXServer.new("/tmp/myapp.sock") while client = server.accept? spawn handle_client(client) end
Creates a named UNIX socket, listening on a filesystem pathname.
Creates a UNIXServer from an already configured raw file descriptor
Creates a new UNIX server and yields it to the block.
Accepts an incoming connection.
Closes the socket, then deletes the filesystem pathname if it exists.
Socket::Server
UNIXSocket
UNIXSocket
UNIXSocket
Socket
Socket
Socket
IO::Evented
IO::Buffered
IO
IO
Reference
Reference
Object
Object
Creates a named UNIX socket, listening on a filesystem pathname.
Always deletes any existing filesystam pathname first, in order to cleanup any leftover socket file.
The server is of stream type by default, but this can be changed for another type. For example datagram messages:
UNIXServer.new("/tmp/dgram.sock", Socket::Type::DGRAM)
Creates a UNIXServer from an already configured raw file descriptor
Creates a new UNIX server and yields it to the block. Eventually closes the server socket when the block returns.
Returns the value of the block.
Accepts an incoming connection.
Returns the client socket or nil
if the server is closed after invoking this method.
Closes the socket, then deletes the filesystem pathname if it exists.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/UNIXServer.html