NAME

POE::Class::Conn::TCPStream - Base class for tcp stream based connection classes

SYNOPSIS

# An echo server connection class
package My::EchoServer;

use POE qw(Class::Conn::TCPStream);

@My::EchoServer::ISA =  qw(POE::Class::Conn::TCPStream);

sub handler_conn_input {
    my ($self, $input) = @_[OBJECT, ARG0];
    return if $self->get_shutdown;
    print "<< $input\n";
    $self->get_wheel->put($input);
}

sub handler_start {
    $_[OBJECT]->SUPER::handler_start(@_[1 .. $#_]);
    printf "Conn session %d started\n", $_[SESSION]->ID;
}

sub handler_stop {
    $_[OBJECT]->SUPER::handler_stop(@_[1 .. $#_]);
    printf "Conn session %d stopped\n", $_[SESSION]->ID;
}

DESCRIPTION

POE::Class::Conn::TCPStream is a base class for tcp stream based connection. This is probably the most common place to subclass in order to do things with Client::* and Server::*. You would normally subclass this module, tell Client::TCP or Server::TCP to use your subclassed connection class. In your subclass you will need to override handler_conn_input as the default is to just croak (it is a virtual method).

This module ISA POE::Class::Conn::Stream which ISA POE::Class::Conn. You will want to see those modules for further details.

ACCESSORS

All accessors have three methods ala POE::Class::Attribs. set_ATTRIB, get_ATTRIB and ATTRIB. Set and get are obvious. ATTRIB is simply a set/get method. See POE::Class::Attribs for more details.

remote_address

Packed remote address and port.

remote_ip

Remote IP address in dotted form.

remote_port

Remote port.

domain

The socket's domain. Will be one of AF_INET, AF_INET6, PF_INET or PF_INET6.

METHODS

There are only two methods in this class. All other methods are inherited.

new

This methods sets up internal data. It also sets the remote_ip() based on the remote_address() and, if using ipv6, the domain().

DESTROY

This method simply cleans up internal data. If you override this method you need to call it in your DESTROY() method via SUPER::DESTROY or your program will leak.

TODO

Write better documentation.

AUTHOR

Scott Beck <sbeck@gossamer-threads.com>

SEE ALSO

POE POE::Class POE::Class::Conn POE::Class::Conn::Stream

1 POD Error

The following errors were encountered while parsing the POD:

Around line 132:

You forgot a '=back' before '=head1'