Skip to content

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

class method

Socket.sockaddr_un

Socket.sockaddr_un(path) => sockaddr
Socket.pack_sockaddr_un(path) => sockaddr

Packs path as an AF_UNIX sockaddr string.

Example
Socket.sockaddr_un("/tmp/sock") #=> "\x01\x00/tmp/sock\x00\x00..."
See also .sockaddr_in .socketpair .pair .tcp also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0