$blocking = $sock->blocking(0) if $timeout;
if (!connect($sock, $addr)) {
- if ($timeout && exists(&IO::EINPROGRESS) && ($! == &IO::EINPROGRESS)) {
+ if ($timeout && $!{EINPROGRESS}) {
require IO::Select;
my $sel = new IO::Select $sock;
$err = $! || (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
$@ = "connect: timeout";
}
- elsif(!connect($sock,$addr)) {
+ elsif(!connect($sock,$addr) && not $!{EISCONN}) {
+ # Some systems refuse to re-connect() to
+ # an already open socket and set errno to EISCONN.
$err = $!;
$@ = "connect: $!";
}
configuration method of the package for that domain, See below.
NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
-
+
As of VERSION 1.18 all IO::Socket objects have autoflush turned on
by default. This was not the case with earlier releases.
new object will be created in the same class as the listen socket, unless
C<PKG> is specified. This object can be used to communicate with the client
that was trying to connect. In a scalar context the new socket is returned,
-or undef upon failure. In an array context a two-element array is returned
+or undef upon failure. In a list context a two-element array is returned
containing the new socket and the peer address; the list will
be empty upon failure.