or return _error($sock, $!, $@);
}
- $sock->blocking($arg->{Blocking}) if defined $arg->{Blocking};
-
$proto ||= (getprotobyname('tcp'))[2];
my $pname = (getprotobynumber($proto))[0];
$sock->socket(AF_INET, $type, $proto) or
return _error($sock, $!, "$!");
+ if (defined $arg->{Blocking}) {
+ defined $sock->blocking($arg->{Blocking})
+ or return _error($sock, $!, "$!");
+ }
+
if ($arg->{Reuse} || $arg->{ReuseAddr}) {
$sock->sockopt(SO_REUSEADDR,1) or
return _error($sock, $!, "$!");
}
$| = 1;
-print "1..20\n";
+print "1..22\n";
eval {
$SIG{ALRM} = sub { die; };
#
local @data;
if( !open( SRC, "< $0")) {
- print "not ok 15 - $!";
+ print "not ok 15 - $!\n";
} else {
@data = <SRC>;
close( SRC);
+ print "ok 15\n";
}
-print "ok 15\n";
### TEST 16
### Start the server
$sock = undef;
}
$listen->close;
+ exit 0;
} else {
die;
}
+# test Blocking option in constructor
+
+$sock = IO::Socket::INET->new(Blocking => 0)
+ or print "not ";
+print "ok 21\n";
+
+my $status = $sock->blocking;
+print "not " unless defined $status && !$status;
+print "ok 22\n";