Foo Ji-Haw wrote:
> Hello guys,
>
> I seem to be stuck with this one. Need your expert input on this.
>
> I used a IO::Socket::INET object to connect to a whois server (port
> 43, and no I'm not trying to parse emails to spam!). I send the
> domain name and read back the whois information. Information is
> returned as a series of strings. Half the time everything is ok.
> Sometimes the reading is 'stuck'; the object cannot return the next
> string, causing the whole program to hang. Below is the code snippet:
>
> my $socket = IO::Socket::INET->new(
> PeerAddr=>$WHOISServer,
> PeerPort=>'43',
> Proto=>'tcp',
> Timeout=>5,
> Type=>SOCK_STREAM,
> );
> return undef if (!$socket);
> while (my $line = <$socket>)
> {
> print "=>$line";
> }
>
> I did a Telnet, and I get the same experience. Sometimes the first
> few lines will come out, then the screen freezes. The only difference
> is that if I press the Enter key a few times Telnet will move on and
> disconnect. I interprete this as perhaps the buffer needs to be
> flushed.
> Unfortunately, according to the documentation autoflush is on by
> default. So I am at my wit's end.
>
> I need a way to make sure my program does not hang here. Is there any
> way I can timeout the reading (notice my Timeout setting in the code.
> Did not work when reading)?
>
> Please advise.
Any reason for not using the a whols module? (see
http://search.cpan.org/search?query=whois&mode=all and 'ppm search
whois').
HTH
--
Brian Raven
-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary
companies.
-----------------------------------------------------------------------
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs