1IO::Socket::INET6(3)  User Contributed Perl Documentation IO::Socket::INET6(3)
2
3
4

NAME

6       IO::Socket::INET6 - [ DEPRECATED!! ] Object interface for
7       AF_INET/AF_INET6 domain sockets
8

SYNOPSIS

10           use IO::Socket::INET6;
11

WARNING

13       WARNING!! IO-Socket-INET6 is deprecated.
14
15       IO-Socket-INET6 was now succeeded by Paul Evans' IO::Socket::IP .
16       Please convert old code from IO-Socket-INET6 to IO-Socket-IP.
17

DESCRIPTION

19       "IO::Socket::INET6" provides an object interface to creating and using
20       sockets in either AF_INET or AF_INET6 domains. It is built upon the
21       IO::Socket interface and inherits all the methods defined by
22       IO::Socket.
23

CONSTRUCTOR

25       new ( [ARGS] )
26           Creates an "IO::Socket::INET6" object, which is a reference to a
27           newly created symbol (see the "Symbol" package). "new" optionally
28           takes arguments, these arguments are in key-value pairs.
29
30           In addition to the key-value pairs accepted by IO::Socket,
31           "IO::Socket::INET6" provides.
32
33               Domain      Address family               AF_INET | AF_INET6 | AF_UNSPEC (default)
34               PeerAddr    Remote host address          <hostname>[:<port>]
35               PeerHost    Synonym for PeerAddr
36               PeerPort    Remote port or service       <service>[(<no>)] | <no>
37               PeerFlow    Remote flow information
38               PeerScope   Remote address scope
39               LocalAddr   Local host bind address      hostname[:port]
40               LocalHost   Synonym for LocalAddr
41               LocalPort   Local host bind port         <service>[(<no>)] | <no>
42               LocalFlow   Local host flow information
43               LocalScope  Local host address scope
44               Proto       Protocol name (or number)    "tcp" | "udp" | ...
45               Type        Socket type                  SOCK_STREAM | SOCK_DGRAM | ...
46               Listen      Queue size for listen
47               ReuseAddr   Set SO_REUSEADDR before binding
48               Reuse       Set SO_REUSEADDR before binding (deprecated, prefer ReuseAddr)
49               ReusePort   Set SO_REUSEPORT before binding
50               Broadcast   Set SO_BROADCAST before binding
51               Timeout     Timeout value for various operations
52               MultiHomed  Try all addresses for multi-homed hosts
53               Blocking    Determine if connection will be blocking mode
54
55           If "Listen" is defined then a listen socket is created, else if the
56           socket type, which is derived from the protocol, is SOCK_STREAM
57           then connect() is called.
58
59           Although it is not illegal, the use of "MultiHomed" on a socket
60           which is in non-blocking mode is of little use. This is because the
61           first connect will never fail with a timeout as the connect call
62           will not block.
63
64           The "PeerAddr" can be a hostname,  the IPv6-address on the
65           "2001:800:40:2a05::10" form , or the IPv4-address on the
66           "213.34.234.245" form.  The "PeerPort" can be a number or a
67           symbolic service name.  The service name might be followed by a
68           number in parenthesis which is used if the service is not known by
69           the system.  The "PeerPort" specification can also be embedded in
70           the "PeerAddr" by preceding it with a ":", and closing the IPv6
71           address on brackets "[]" if necessary:
72           "124.678.12.34:23","[2a05:345f::10]:23","any.server.com:23".
73
74           If "Domain" is not given, AF_UNSPEC is assumed, that is, both
75           AF_INET and AF_INET6 will be both considered when resolving DNS
76           names. AF_INET6 has priority.  If you guess you are in trouble not
77           reaching the peer,(the service is not available via AF_INET6 but
78           AF_INET) you can either try Multihomed (try any address/family
79           until reach) or concrete your address "family" (AF_INET, AF_INET6).
80
81           If "Proto" is not given and you specify a symbolic "PeerPort" port,
82           then the constructor will try to derive "Proto" from the service
83           name.  As a last resort "Proto" "tcp" is assumed.  The "Type"
84           parameter will be deduced from "Proto" if not specified.
85
86           If the constructor is only passed a single argument, it is assumed
87           to be a "PeerAddr" specification.
88
89           If "Blocking" is set to 0, the connection will be in nonblocking
90           mode.  If not specified it defaults to 1 (blocking mode).
91
92           Examples:
93
94              $sock = IO::Socket::INET6->new(PeerAddr => 'www.perl.org',
95                                            PeerPort => 'http(80)',
96                                            Proto    => 'tcp');
97
98           Suppose either you have no IPv6 connectivity or www.perl.org has no
99           http service on IPv6. Then,
100
101           (Trying all address/families until reach)
102
103              $sock = IO::Socket::INET6->new(PeerAddr => 'www.perl.org',
104                                            PeerPort => 'http(80)',
105                                            Multihomed => 1 ,
106                                            Proto    => 'tcp');
107
108           (Concrete to IPv4 protocol)
109
110              $sock = IO::Socket::INET6->new(PeerAddr => 'www.perl.org',
111                                            PeerPort => 'http(80)',
112                                            Domain => AF_INET ,
113                                            Proto    => 'tcp');
114
115
116              $sock = IO::Socket::INET6->new(PeerAddr => 'localhost:smtp(25)');
117
118              $sock = IO::Socket::INET6->new(Listen    => 5,
119                                            LocalAddr => 'localhost',
120                                            LocalPort => 9000,
121                                            Proto     => 'tcp');
122
123              $sock = IO::Socket::INET6->new('[::1]:25');
124
125              $sock = IO::Socket::INET6->new(PeerPort  => 9999,
126                                            PeerAddr  => Socket6::inet_ntop(AF_INET6,in6addr_broadcast),
127                                            Proto     => udp,
128                                            LocalAddr => 'localhost',
129                                            Broadcast => 1 )
130                                        or die "Can't bind : $@\n";
131
132            NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
133
134           As of VERSION 1.18 all IO::Socket objects have autoflush turned on
135           by default. This was not the case with earlier releases.
136
137            NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
138
139   METHODS
140       accept ()
141           See IO::Socket::INET.
142
143       bind ()
144           See IO::Socket::INET.
145
146       configure ()
147           This function exists in this module, but I (= Shlomi Fish) don't
148           know what it does, or understand it. It's also not tested anywhere.
149           I'll be happy to be enlightened.
150
151       connect ()
152           See IO::Socket::INET.
153
154       sockaddr ()
155           Return the address part of the sockaddr structure for the socket
156
157       sockdomain()
158           Returns the domain of the socket - AF_INET or AF_INET6 or whatever.
159
160       sockport ()
161           Return the port number that the socket is using on the local host
162
163       sockhost ()
164           Return the address part of the sockaddr structure for the socket in
165           a text form ("2001:800:40:2a05::10" or "245.245.13.27")
166
167       sockflow ()
168           Return the flow information part of the sockaddr structure for the
169           socket
170
171       sockscope ()
172           Return the scope identification part of the sockaddr structure for
173           the socket
174
175       peeraddr ()
176           Return the address part of the sockaddr structure for the socket on
177           the peer host
178
179       peerport ()
180           Return the port number for the socket on the peer host.
181
182       peerhost ()
183           Return the address part of the sockaddr structure for the socket on
184           the peer host in a text form ("2001:800:40:2a05::10" or
185           "245.245.13.27")
186
187       peerflow ()
188           Return the flow information part of the sockaddr structure for the
189           socket on the peer host
190
191       peerscope ()
192           Return the scope identification part of the sockaddr structure for
193           the socket on the peer host
194

REPOSITORY

196       The Subversion repository for this module carrying complete version
197       history and other information is:
198
199       <http://svn.berlios.de/svnroot/repos/web-cpan/IO-Socket-INET6/>
200

SEE ALSO

202       Socket,Socket6, IO::Socket
203

AUTHOR

205       This program is based on IO::Socket::INET by Graham Barr
206       <gbarr@pobox.com> and currently maintained by the Perl Porters.
207
208       Modified by Rafael Martinez Torres <rafael.martinez@novagnet.com> and
209       Euro6IX project.
210
211       Modified further by Shlomi Fish <shlomif@iglu.org.il>, while
212       disclaiming all copyrights.
213
215       Copyright (c) 2003- Rafael Martinez Torres
216       <rafael.martinez@novagnet.com>.
217
218       Copyright (c) 2003- Euro6IX project.
219
220       Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>.
221
222       All rights reserved.
223
224       This program is free software; you can redistribute it and/or modify it
225       under the same terms as Perl itself.
226
227
228
229perl v5.38.0                      2023-07-20              IO::Socket::INET6(3)
Impressum