Click here to get back home

Need to handle the NNTP connection timeout in my code

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Need to handle the NNTP connection timeout in my code Naren 02-08-2007
Posted by Naren on February 8, 2007, 4:51 am
Please log in for more thread options


Hi All,
I have a perl script that use cpan NNTP.pm perl module for NNTP
connection. I am passing the timeout as one parameter while opening
the NNTP connection. I am intentionally timing out the NNTP
connection. When I open the connection in debug mode, then I could see
my connection is timing out. My question is how do I capture this
timing out error in my code.

Any suggesstion would be aprreciated.


Posted by boyd on February 8, 2007, 12:42 pm
Please log in for more thread options



> Hi All,
> I have a perl script that use cpan NNTP.pm perl module for NNTP
> connection. I am passing the timeout as one parameter while opening
> the NNTP connection. I am intentionally timing out the NNTP
> connection. When I open the connection in debug mode, then I could see
> my connection is timing out. My question is how do I capture this
> timing out error in my code.
>
> Any suggesstion would be aprreciated.

in perldoc perlipc, you can see an example of how to force a timeout
outside the NNTP module. It would be something like this:
eval{
local $SIG = sub{die "timed out"};
alarm $timeout_secs;
# code goes here for your NNTP connection -leave out the timeout
alarm 0; # cancel the alarm if it gets here before timeout
};
if( $@ and $@ =~ /timed out/){
print "The NNTP connection timed out\n";
}

Boyd

Similar ThreadsPosted
Using a DBI connection in many places (in the code) August 4, 2008, 4:39 am
for therese: genuinely magnetic nntp access - fel - (1/1) March 31, 2007, 7:14 pm
attn: gerrie - highly superb nntp access - wem gahlo - (1/1) January 30, 2007, 3:25 am
SSL LWP Timeout problem September 21, 2004, 2:25 pm
"500 SSL read timeout" September 27, 2004, 11:50 am
Gtk and Glib::Timeout June 8, 2006, 7:30 am
Net-DHCPClient cant get timeout September 12, 2006, 1:37 pm
Cannot get timeout error message from Net::Cmd January 4, 2005, 4:45 pm
IO::Socket default timeout September 25, 2006, 2:35 pm
Apache2::RequestIO::read: timeout error January 4, 2007, 3:32 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap