home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>POE::Wheel::ListenAccept - POE Listen/Accept Logic Abstraction</TITLE>
- <LINK REL="stylesheet" HREF="../../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> POE::Wheel::ListenAccept - POE Listen/Accept Logic Abstraction</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#public methods">PUBLIC METHODS</A></LI>
- <LI><A HREF="#events and parameters">EVENTS AND PARAMETERS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#bugs">BUGS</A></LI>
- <LI><A HREF="#authors & copyrights">AUTHORS & COPYRIGHTS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>POE::Wheel::ListenAccept - POE Listen/Accept Logic Abstraction</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- $wheel = new POE::Wheel::ListenAccept(
- Handle => $socket_handle, # Listening socket
- AcceptState => $accept_state_name, # Success state
- ErrorState => $error_state_name, # Failure state
- );</PRE>
- <PRE>
- $wheel->event( AcceptState => $new_state_name ); # Add/change state
- $wheel->event( ErrorState => undef ); # Remove state</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>ListenAccept waits for activity on a listening socket and accepts
- remote connections as they arrive. It generates events for successful
- and failed connections (EAGAIN is not considered to be a failure).</P>
- <P>This wheel neither needs nor includes a <CODE>put()</CODE> method.</P>
- <P>ListenAccept is a good way to listen on sockets from other sources,
- such as IO::Socket or plain <A HREF="../../../../lib/Pod/perlfunc.html#item_socket"><CODE>socket()</CODE></A> calls.</P>
- <P>
- <HR>
- <H1><A NAME="public methods">PUBLIC METHODS</A></H1>
- <P>POE::Wheel::ListenAccept::event( ... )</P>
- <P>The <CODE>event()</CODE> method changes the events that a ListenAccept wheel emits
- for different conditions. It accepts a list of event types and
- values. Defined state names change the previous values. Undefined
- ones turn off the given condition's events.</P>
- <P>For example, this <CODE>event()</CODE> call changes a wheel's AcceptState event and
- turns off its ErrorState event.</P>
- <PRE>
- $wheel->event( AcceptState => $new_accept_state_name,
- ErrorState => undef
- );</PRE>
- <P>
- <HR>
- <H1><A NAME="events and parameters">EVENTS AND PARAMETERS</A></H1>
- <UL>
- <LI>
- AcceptState
- <P>The AcceptState event contains the name of the state that will be
- called when a new connection has been accepted.</P>
- <P>The ARG0 parameter contains the accepted connection's new socket
- handle.</P>
- <P>A sample AcceptState state:</P>
- <PRE>
- sub accept_state {
- my $accepted_handle = $_[ARG0];
- # Optional security things with getpeername might go here.
- &create_server_session($handle);
- }</PRE>
- <P></P>
- <LI>
- ErrorState
- <P>The ErrorState event contains the name of the state that will be
- called when a socket error occurs. The ListenAccept wheel knows what
- to do with EAGAIN, so it's not considered an error worth reporting.</P>
- <P>The ARG0 parameter contains the name of the function that failed.
- This usually is 'accept'. ARG1 and ARG2 contain the numeric and
- string versions of $! at the time of the error, respectively.</P>
- <P>A sample ErrorState state:</P>
- <PRE>
- sub error_state {
- my ($operation, $errnum, $errstr) = @_[ARG0, ARG1, ARG2];
- warn "$operation error $errnum: $errstr\n";
- }</PRE>
- <P></P></UL>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P>POE::Wheel; POE::Wheel::FollowTail; POE::Wheel::ReadWrite;
- POE::Wheel::SocketFactory</P>
- <P>
- <HR>
- <H1><A NAME="bugs">BUGS</A></H1>
- <P>Oh, probably some.</P>
- <P>
- <HR>
- <H1><A NAME="authors & copyrights">AUTHORS & COPYRIGHTS</A></H1>
- <P>Please see the POE manpage.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> POE::Wheel::ListenAccept - POE Listen/Accept Logic Abstraction</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-