.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "POE::Component::Connection::Keepalive 3pm" .TH POE::Component::Connection::Keepalive 3pm "2022-06-18" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" POE::Component::Connection::Keepalive \- a wheel wrapper around a kept\-alive socket .SH "VERSION" .IX Header "VERSION" version 0.272 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& See the SYNOPSIS for POE::Component::Client::Keepalive for a \& complete working example. \& \& my $connection = $response\->{connection}; \& $heap\->{connection} = $connection; \& \& $connection\->start( InputEvent => "got_input" ); \& \& delete $heap\->{connection}; # When done with it. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" POE::Component::Connection::Keepalive is a helper class for POE::Component::Client::Keepalive. It wraps managed sockets, providing a few extra features. .PP Connection objects free their underlying sockets when they are DESTROYed. This eliminates the need to explicitly free sockets when you are done with them. .PP Connection objects manage POE::Wheel::ReadWrite objects internally, saving a bit of effort. .IP "new" 2 .IX Item "new" Creates a new POE::Component::Connection::Keepalive instance. It accepts two parameters: A socket handle (socket) and a reference to a POE::Component::Client::Keepalive object to manage the socket when the connection is destroyed. .Sp .Vb 4 \& my $conn = POE::Component::Connection::Keepalive\->new( \& socket => $socket_handle, \& manager => $poe_component_client_keepalive, \& ); .Ve .Sp \&\fBnew()\fR is usually called by a POE::Component::Client::Keepalive object. .IP "start" 2 .IX Item "start" Starts a POE::Wheel::ReadWrite object. All parameters except Handle for \fBstart()\fR are passed directly to POE::Wheel::ReadWrite's constructor. Handle is provided by the connection object. \fBstart()\fR returns a reference to the new POE::Wheel::ReadWrite object, but it is not necessary to save a copy of that wheel. The connection object keeps a copy of the reference internally, so the wheel will persist as long as the connection does. The POE::Wheel::ReadWrite object will be DESTROYed when the connection object is. .Sp .Vb 4 \& # Asynchronous connection from Client::Keepalive. \& sub handle_connection { \& my $connection_info = $_[ARG0]; \& $_[HEAP]\->{connection} = $connection_info\->{connection}; \& \& $heap\->{connection}\->start( \& InputEvent => "got_input", \& ErrorEvent => "got_error", \& ); \& } \& \& # Stop the connection (and the wheel) when an error occurs. \& sub handle_error { \& delete $_[HEAP]\->{connection}; \& } .Ve .IP "wheel" 2 .IX Item "wheel" Returns a reference to the internal POE::Wheel::ReadWrite object, so that methods may be called upon it. .Sp .Vb 1 \& $heap\->{connection}\->wheel()\->pause_input(); .Ve .IP "close" 2 .IX Item "close" Closes the connection immediately. Calls \fBshutdown_input()\fR and \&\fBshutdown_output()\fR on the wheel also. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1POE\s0 POE::Component::Client::Keepalive POE::Wheel::ReadWrite .SH "BUGS" .IX Header "BUGS" None known. .SH "LICENSE" .IX Header "LICENSE" This distribution is copyright 2004\-2009 by Rocco Caputo. All rights are reserved. This distribution is free software; you may redistribute it and/or modify it under the same terms as Perl itself. .SH "AUTHOR" .IX Header "AUTHOR" Rocco Caputo .PP Special thanks to Rob Bloodgood.