IO::Socket::UNIX Reference
The IO::Socket::UNIX subclass creates a Unix-domain
socket. Unix-domain sockets are local to the current host and are
used internally to implement pipes, thus providing communication
between unrelated processes. Using sockets provides finer control
than using named pipes, also called FIFO (first-in, first-out)
buffers. This is because receiving sockets can distinguish between
different client connections, which can then be assigned to
different sessions with the accept
call.
The IO::Socket::UNIX constructor (new( )
) creates the socket and returns an
object containing a filehandle. The constructor can take the
following options:
Type => SOCK_STREAM | SOCK_DGRAM
Indicates the type of socket:
SOCK_STREAM
for streaming,SOCK_DGRAM
for packets or datagrams.Local =>
pathname
Provides the pathname of the FIFO buffer to bind to the socket.
Peer =>
pathname
Provides the pathname to the destination FIFO buffer.
Listen =>
n
Creates a listen socket and sets the queue size to
n
.
The following methods can be used on an object created with IO::Socket::UNIX.
Get Perl in a Nutshell, 2nd Edition 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.