Re: How to deal with event timeout?
[email protected] (Rocco Caputo) Mon, 22 Mar 2010 15:15:00 -0400
| Newsgroups | perl.poe |
|---|---|
| Message-ID | <[email protected]> |
You can set a timeout for anything by using POE::Kernel's delay().
sub _start {
... in addition to the PoCo::Client::NNTP SYNOPSIS code:
$kernel->delay(connect_timeout => 60); # set it
}
sub _connected {
... in addition to the PoCo::Client::NNTP SYNOPSIS code:
$kernel->delay(connect_timeout => undef); # clear it
}
You will need to register a connect_timeout handler in POE::Session-
>create() to catch the timeout.
--
Rocco Caputo - [email protected]
On Mar 22, 2010, at 10:00, Ryan Chan wrote:
> For example, I am using POE::Component::Client::NNTP
>
> http://search.cpan.org/~bingos/POE-Component-Client-NNTP-2.14/lib/POE/Component/Client/NNTP.pm
>
> This module does not specify any timeout, so sometimes my program
> seems hanged and does not response.
>
> Is it possible to specify a timeout or lifetime for the event, so it
> will quit when reached the specified time?