1INET6(3)              User Contributed Perl Documentation             INET6(3)
2
3
4

NAME

6       IO::Socket::INET6 - Object interface for AF_INET⎪AF_INET6 domain sock‐
7       ets
8

SYNOPSIS

10           use IO::Socket::INET6;
11

DESCRIPTION

13       "IO::Socket::INET6" provides an object interface to creating and using
14       sockets in either AF_INET or AF_INET6 domains. It is built upon the
15       IO::Socket interface and inherits all the methods defined by
16       IO::Socket.
17

CONSTRUCTOR

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

SEE ALSO

173       Socket,Socket6, IO::Socket
174

AUTHOR

176       This program is based on IO::Socket::INET by Graham Barr
177       <gbarr@pobox.com> and currently maintained by the Perl Porters.
178
179       Modified by Rafael Martinez Torres <rafael.martinez@novagnet.com> and
180       Euro6IX project.
181
183       Copyright (c) 2003- Rafael Martinez Torres <rafael.mar‐
184       tinez@novagnet.com>.
185
186       Copyright (c) 2003- Euro6IX project.
187
188       Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>.
189
190       All rights reserved.
191
192       This program is free software; you can redistribute it and/or modify it
193       under the same terms as Perl itself.
194
195
196
197perl v5.8.8                       2004-10-18                          INET6(3)
Impressum