The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

POE::Component::GCS::Server::TCP - Generic network TCP service

VERSION

This document describes version 0.01, released November, 2005.

SYNOPSIS

# Startup:

use POE::Component::GCS::Server::TCP;
spawn POE::Component::GCS::Server::TCP;

# Shutdown:

$Cmd = "POE::Component::GCS::Server::Cmd";
$Msg = "POE::Component::GCS::Server::Msg";

$message = $Msg->new( undef, "shutdown" );
$Cmd->dispatch( $message );

DESCRIPTION

This class implements a generic network TCP server allowing clients to send 'command messages' to the server daemon process. The incoming messages from the clients are expected to be either objects of the 'POE::Event::Message' class or subclasses thereof, or plain text commands.

Note that a separate network port address is used for 'message objects', and another network port is used for 'plain text'. Be sure to send the correct message type to the correct port.

Note that 'shutdown' messages may be ignored unless they are validated by the 'Command Dispatch' class.

Constructor

spawn ( PortNumber )

This creates a TCP server session and begins listening on the specified network PortNumber.

Methods

There are no other public methods defined in this class.

Events

This class has no events that are called explicitly. It accepts client connections and adds a routing mechanism to the header of the incoming messages to facilitate returning output back to the client process.

All incoming messages are dispatched to the 'Command' clas for validation and further action, if any.

DEPENDENCIES

This class expects to be run within the POE framework.

SEE ALSO

For discussion of the generic server, see POE::Component::GCS::Server. For discussion of the message protocol, see POE::Event::Message. For discussion of message extensions, see POE::Component::GCS::Server::Msg.

See POE::Component::GCS::ClientTxt, POE::Component::GCS::ClientMsg and POE::Component::GCS::Client for examples of using message-based and/or text-based command messages.

AUTHOR

Chris Cobb, <no spam [at] ccobb [dot] net>

COPYRIGHT

Copyright (c) 2005-2010 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.