Name

UNIXSocket — Unix domain socket class

Synopsis

UNIXSocket is a class for the Unix domain, which can be specified by the path.

Required Library

require ’socket’

Inherited Class

BasicSocket

Class Methods

UNIXSocket::new(path)
UNIXSocket::open(path)

Creates a Unix domain socket

Instance Methods

s.addr

Returns an array containing information on the socket (AF_UNIX and the path)

s.path

Returns the path of the Unix domain socket

s.peeraddr

Returns an array containing information on the peer socket in the same format as s.addr

s.recvfrom(len[, flag=0])

Receives data and returns it in an array that also includes information on the sender’s socket in the same format as s.addr

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.