develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000421.005] Broken pipe when connecting a IO::Socket::INETto an invalid port on a valid host

April 21, 2000 15:37
[ID 20000421.005] Broken pipe when connecting a IO::Socket::INETto an invalid port on a valid host
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.28 running under perl v5.6.0.

[Please enter your report here]
When connecting a IO::Socket::INET socket to an invalid port on a valid host,
Perl-5.6.0 dies abruptly with a "Broken pipe". Here is a sample of code that
causes the error on my system:

use IO::Socket::INET;

my($host, $port, $timeout) = ('', '8080', '180'); 

my $sock = IO::Socket::INET->new('PeerAddr' => $host,
				 'PeerPort' => $port,
				 'Proto'    => 'tcp',
				 'Timeout'  => $timeout);

If the host is invalid this code will return undef like it is supposed to. If
all is well, the socket also works fine, but if the port is invalid that is when
the "Broken pipe" occurs (This works fine with Perl5.005_03 on my system).

I've traced the code and the pipe breaks when the line

return scalar(%arg) ? $sock->configure(\%arg) : $sock;

is executed inside of IO::Socket->new() (Particulary the 
$sock->configure(\%arg) part).

Your welcome.

[Please do not change anything below this line]
Site configuration information for perl v5.6.0:

Configured by oberpwd at Fri Apr 21 14:19:21 CDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos truck 5.5.1 generic_103640-27 sun4u sparc sunw,ultra-1 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
    cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
    cppflags='-fno-strict-aliasing -I/home/anubis22/oberpwd/gnu/include'
    ccflags ='-fno-strict-aliasing -I/home/anubis22/oberpwd/gnu/include '
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-L/home/anubis22/oberpwd/gnu/lib -L/lib -L/usr/lib -L/usr/ccs/lib '
    libpth=/home/anubis22/oberpwd/gnu/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/home/anubis22/oberpwd/gnu/lib -L/lib -L/usr/lib -L/usr/ccs/lib'

Locally applied patches:

@INC for perl v5.6.0:

Environment for perl v5.6.0:
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/csh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About