the socket will be in. All other arguments will be passed to the
configuration method of the package for that domain, See below.
+C<IO::Socket>s will be in autoflush mode after creation.
+
=back
=head1 METHODS
@ISA = qw(IO::Handle);
-$VERSION = "1.1602";
+$VERSION = "1.1603";
sub import {
my $pkg = shift;
sub new {
my($class,%arg) = @_;
my $fh = $class->SUPER::new();
+ $fh->autoflush;
${*$fh}{'io_socket_timeout'} = delete $arg{Timeout};
PeerPort Remote port or service <service>[(<no>)] | <no>
LocalAddr Local host bind address hostname[:port]
LocalPort Local host bind port <service>[(<no>)] | <no>
- Proto Protocol name "tcp" | "udp" | ...
+ Proto Protocol name (or number) "tcp" | "udp" | ...
Type Socket type SOCK_STREAM | SOCK_DGRAM | ...
Listen Queue size for listen
Reuse Set SO_REUSEADDR before binding
The C<PeerPort> specification can also be embedded in the C<PeerAddr>
by preceding it with a ":".
-Only one of C<Type> or C<Proto> needs to be specified, one will be
-assumed from the other. If you specify a symbolic C<PeerPort> port,
-then the constructor will try to derive C<Type> and C<Proto> from
-the service name.
+If C<Proto> is not given and you specify a symbolic C<PeerPort> port,
+then the constructor will try to derive C<Proto> from the service
+name. As a last resort C<Proto> "tcp" is assumed. The C<Type>
+parameter will be deduced from C<Proto> if not specified.
+
+If the constructor is only passed a single argument, it is assumed to
+be a C<PeerAddr> specification.
Examples:
LocalPort => 9000,
Proto => 'tcp');
+ $sock = IO::Socket::INET->new('127.0.0.1:25');
+
+
=head2 METHODS
=over 4
=cut
+sub new
+{
+ my $class = shift;
+ unshift(@_, "PeerAddr") if @_ == 1;
+ return $class->SUPER::new(@_);
+}
+
sub _sock_info {
my($addr,$port,$proto) = @_;
my @proto = ();
unless(defined $raddr);
}
+ $proto ||= (getprotobyname "tcp")[2];
return _error($fh,'Cannot determine protocol')
unless($proto);