Debian Codegraph @

upstream/mageia-cauldron/man3pm/IO::Socket::UNIX.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "IO::Socket::UNIX 3pm"
61 .TH IO::Socket::UNIX 3pm 2023-12-22 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 IO::Socket::UNIX \- Object interface for AF_UNIX domain sockets
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& use IO::Socket::UNIX;
72 \&
73 \& my $SOCK_PATH = "$ENV{HOME}/unix\-domain\-socket\-test.sock";
74 \&
75 \& # Server:
76 \& my $server = IO::Socket::UNIX\->new(
77 \& Type => SOCK_STREAM(),
78 \& Local => $SOCK_PATH,
79 \& Listen => 1,
80 \& );
81 \&
82 \& my $count = 1;
83 \& while (my $conn = $server\->accept()) {
84 \& $conn\->print("Hello " . ($count++) . "\en");
85 \& }
86 \&
87 \& # Client:
88 \& my $client = IO::Socket::UNIX\->new(
89 \& Type => SOCK_STREAM(),
90 \& Peer => $SOCK_PATH,
91 \& );
92 \&
93 \& # Now read and write from $client
94 .Ve
95 .SH DESCRIPTION
96 .IX Header "DESCRIPTION"
97 \&\f(CW\*(C`IO::Socket::UNIX\*(C'\fR provides an object interface to creating and using sockets
98 in the AF_UNIX domain. It is built upon the IO::Socket interface and
99 inherits all the methods defined by IO::Socket.
100 .SH CONSTRUCTOR
101 .IX Header "CONSTRUCTOR"
102 .IP "new ( [ARGS] )" 4
103 .IX Item "new ( [ARGS] )"
104 Creates an \f(CW\*(C`IO::Socket::UNIX\*(C'\fR object, which is a reference to a
105 newly created symbol (see the Symbol package). \f(CW\*(C`new\*(C'\fR
106 optionally takes arguments, these arguments are in key\-value pairs.
107 .Sp
108 In addition to the key\-value pairs accepted by IO::Socket,
109 \&\f(CW\*(C`IO::Socket::UNIX\*(C'\fR provides.
110 .Sp
111 .Vb 4
112 \& Type Type of socket (eg SOCK_STREAM or SOCK_DGRAM)
113 \& Local Path to local fifo
114 \& Peer Path to peer fifo
115 \& Listen Queue size for listen
116 .Ve
117 .Sp
118 If the constructor is only passed a single argument, it is assumed to
119 be a \f(CW\*(C`Peer\*(C'\fR specification.
120 .Sp
121 If the \f(CW\*(C`Listen\*(C'\fR argument is given, but false, the queue size will be set to 5.
122 .Sp
123 If the constructor fails it will return \f(CW\*(C`undef\*(C'\fR and set the
124 \&\f(CW$IO::Socket::errstr\fR package variable to contain an error message.
125 .Sp
126 .Vb 2
127 \& $sock = IO::Socket::UNIX\->new(...)
128 \& or die "Cannot create socket \- $IO::Socket::errstr\en";
129 .Ve
130 .Sp
131 For legacy reasons the error message is also set into the global \f(CW$@\fR
132 variable, and you may still find older code which looks here instead.
133 .Sp
134 .Vb 2
135 \& $sock = IO::Socket::UNIX\->new(...)
136 \& or die "Cannot create socket \- $@\en";
137 .Ve
138 .SH METHODS
139 .IX Header "METHODS"
140 .IP \fBhostpath()\fR 4
141 .IX Item "hostpath()"
142 Returns the pathname to the fifo at the local end
143 .IP \fBpeerpath()\fR 4
144 .IX Item "peerpath()"
145 Returns the pathanme to the fifo at the peer end
146 .SH "SEE ALSO"
147 .IX Header "SEE ALSO"
148 Socket, IO::Socket
149 .SH AUTHOR
150 .IX Header "AUTHOR"
151 Graham Barr. Currently maintained by the Perl Porters. Please report all
152 bugs at <https://github.com/Perl/perl5/issues>.
153 .SH COPYRIGHT
154 .IX Header "COPYRIGHT"
155 Copyright (c) 1996\-8 Graham Barr <[email protected]>. All rights reserved.
156 This program is free software; you can redistribute it and/or
157 modify it under the same terms as Perl itself.