Subject: Re: problem with perl5 and connect
To: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
From: matthew green <mrg@mame.mu.oz.au>
List: current-users
Date: 06/02/1995 13:49:55
> jonb@bullbox[20]% pt mail.metronet.com 110
> connect: Connection timed out at pt line 26.
> jonb@bullbox[21]% head -30 pt | tail 10
> $this = pack($sockaddr, AF_INET, 0, $thisaddr);
> $that = pack($sockaddr, AF_INET, $port, $thataddr);
>
> socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
> bind(S, $this) || die "bind: $!";
> connect(S, $that) || die "connect: $!";
> Notice that the name lookup goes fine, even binding to the socket,
> but it won't connect... 8-( Any help would be appreciated,
Did you try tracing it to see what address it's _really_ trying to
connect to? You may have the address in the wrong byte order, which
would do it if you're on a little-endian machine. (The port may also
be in the wrong byte order but if the address is right and the port is
wrong, I'd expect a fast "Connection refused" rather than a timeout.)
this is unlikely; the definition of $sockaddr is not shown above,
but the "common" case for this in perl uses the correct network/host
arguments to pack/unpack. i've never seen one that didn't.
but the problem remains -- there isn't enough information in the
above snippet of code. jon, please show more of the code, or
reduce the case to a very short script.
.mrg.