1IO::Socket::UNIX(3pm)  Perl Programmers Reference Guide  IO::Socket::UNIX(3pm)
2
3
4

NAME

6       IO::Socket::UNIX - Object interface for AF_UNIX domain sockets
7

SYNOPSIS

9           use IO::Socket::UNIX;
10
11           my $SOCK_PATH = "$ENV{HOME}/unix-domain-socket-test.sock";
12
13           # Server:
14           my $server = IO::Socket::UNIX->new(
15               Type => SOCK_STREAM(),
16               Local => $SOCK_PATH,
17               Listen => 1,
18           );
19
20           my $count = 1;
21           while (my $conn = $server->accept()) {
22               $conn->print("Hello " . ($count++) . "\n");
23           }
24
25           # Client:
26           my $client = IO::Socket::UNIX->new(
27               Type => SOCK_STREAM(),
28               Peer => $SOCK_PATH,
29           );
30
31           # Now read and write from $client
32

DESCRIPTION

34       "IO::Socket::UNIX" provides an object interface to creating and using
35       sockets in the AF_UNIX domain. It is built upon the IO::Socket
36       interface and inherits all the methods defined by IO::Socket.
37

CONSTRUCTOR

39       new ( [ARGS] )
40           Creates an "IO::Socket::UNIX" object, which is a reference to a
41           newly created symbol (see the "Symbol" package). "new" optionally
42           takes arguments, these arguments are in key-value pairs.
43
44           In addition to the key-value pairs accepted by IO::Socket,
45           "IO::Socket::UNIX" provides.
46
47               Type        Type of socket (eg SOCK_STREAM or SOCK_DGRAM)
48               Local       Path to local fifo
49               Peer        Path to peer fifo
50               Listen      Queue size for listen
51
52           If the constructor is only passed a single argument, it is assumed
53           to be a "Peer" specification.
54
55           If the "Listen" argument is given, but false, the queue size will
56           be set to 5.
57

METHODS

59       hostpath()
60           Returns the pathname to the fifo at the local end
61
62       peerpath()
63           Returns the pathanme to the fifo at the peer end
64

SEE ALSO

66       Socket, IO::Socket
67

AUTHOR

69       Graham Barr. Currently maintained by the Perl Porters.  Please report
70       all bugs to <perlbug@perl.org>.
71
73       Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights
74       reserved.  This program is free software; you can redistribute it
75       and/or modify it under the same terms as Perl itself.
76
77
78
79perl v5.28.2                      2018-11-01             IO::Socket::UNIX(3pm)
Impressum