Re: TCP keepalive?
flw <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
new POE::Component::Client::TCP(
.........
.........
Connected => {
my ($socket, $peer_addr, $peer_port) = @_[ARG0, ARG1, ARG2];
setsockopt( $socket, SOL_SOCKET, SO_KEEPALIVE, 1 );
}
.........
);
2009/10/21 Adams Sean <[email protected]>
>
> never mind, this was easy to enable globally by modifying SocketFactory.pm
> @ line 706:
>
> setsockopt($socket_handle, SOL_SOCKET, SO_KEEPALIVE, 1) or do {
> $poe_kernel->yield(
> $event_failure,
> 'setsockopt', $!+0, $!, $self->[MY_UNIQUE_ID]
> );
> return $self;
> };
>
> Although I think POE should expose the option to users of Client::TCP... do
> you want a patch for this?
>
>
>
> On Oct 19, 2009, at 11:14 AM, Adams Sean wrote:
>
>
>>
>> What is the best way to enable TCP keepalive on a
>> POE::Component::Client::TCP session?
>>
>>
>> I am using POE for home automation and I have connections which are often
>> idle for hours, or only get traffic in the receive direction. In these cases
>> there is no indication that the connection has failed if, for example, the
>> endpoint resets due to power outage.
>>
>>
>>
>