Re: How to deal with event timeout?

2010-03-23 Thread Rocco Caputo

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 - rcap...@pobox.com


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?




How to deal with event timeout?

2010-03-22 Thread Ryan Chan
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?


Re: How to deal with event timeout?

2010-03-22 Thread Jeremy Leader
Can't you just use a name-based timer, re-set it every time you get any 
activity, and when it goes off (implying no activity for the duration of the 
timer), shut down?


http://search.cpan.org/~rcaputo/POE-1.287/lib/POE/Kernel.pm#delay_set_EVENT_NAME,_DURATION_SECONDS_[,_PARAMETER_LIST]

--
Jeremy Leader
jlea...@oversee.net
jlea...@alumni.caltech.edu

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?