Re: Need to handle the NNTP connection timeout in my code
- From: boyd <tbmoore9@xxxxxxxxxxx>
- Date: Thu, 08 Feb 2007 17:42:31 GMT
In article <1170928309.001111.249450@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Naren" <naren.sarkar@xxxxxxxxx> wrote:
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{ALRM} = 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
.
- References:
- Prev by Date: Error installing Net::SSH2
- Next by Date: Re: system return value?
- Previous by thread: Need to handle the NNTP connection timeout in my code
- Next by thread: Error installing Net::SSH2
- Index(es):
Relevant Pages
|
|