NAME
Sprocket::Server - The Sprocket Server
SYNOPSIS
use Sprocket qw( Server );
Sprocket::Server->spawn(
    Name => 'Test Server',        # Optional, defaults to Server
    ListenAddress => '127.0.0.1', # Optional, defaults to INADDR_ANY
    ListenPort => 9979,           # Optional, defaults to 0 (random port)
    Domain => AF_INET,            # Optional, defaults to AF_INET
    Reuse => 'yes',               # Optional, defaults to yes
    Plugins => [
        {
            plugin => MyPlugin->new(),
            priority => 0, # default
        },
    ],
    LogLevel => 4,
    MaxConnections => 10000,
);
DESCRIPTION
Sprocket::Server defines a TCP/IP Server, it binds to a Address and Port and listens for incoming TCP/IP connections.
METHODS
- spawn( %options )
 - 
Create a new Sprocket::Server object.
- Name => (str)
 - 
The Name for this server. This is used for logging. It is optional and defaults to 'Server'
 - ListenPort => (int)
 - 
The port this server listens on.
 - ListenAddress => (str)
 - 
The address this server listens on.
 - Domain => (const)
 - 
The domain type for the socket. Defaults to AF_INET. For UNIX sockets, see Sprocket::Server::UNIX
 - LogLevel => (int)
 - 
The minimum level of logging, defaults to 4
 - Logger => (object)
 - 
Sprocket::Logger::Basic is the default and logs to STDERR. The object must support put( $server, { v => $level, msg => $msg } ) or wrap a logging system using this format. See also Sprocket::Logger::Log4perl
 - MaxConnections => (int)
 - 
Sprocket will set the rlimit to this value using BSD::Resource
 - Plugins => (array ref of hash refs)
 - 
Plugins that this server will hand off processing to. In an array ref of hash ref's format as so:
{ plugin => MyPlugin->new(), priority => 0 # default } 
 - shutdown( $type )
 - 
Shutdown this server. If $type is 'soft' then a soft shutdown procedure will begin. local_shutdown will be called for each connection.
 - name
 - 
The name of the server, specified during spawn.
 - session_id
 - 
Session id of the controlling poe session.
 - uuid
 - 
UUID of the server, generated during spawn.
 - shutting_down
 - 
returns the shutdown type, ie. 'soft' if shutting down, otherwize, undef.
 - connections
 - 
returns the number of connections
 - _logger
 - 
returns the logger object.
 - opts
 - 
returns a hash ref of the options passed to spawn
 - is_forked
 - 
true if the server is pre-forked
 - is_child
 - 
true if this instance is a forked process. You can determine if you're in the parent process if is_child is false and is_forked is true.
 
HOOKS
See Sprocket for observer hook semantics.
- sprocket.local.connection.accept
 - sprocket.local.connection.reject
 - sprocket.local.connection.receive
 - sprocket.local.wheel.error
 
EVENTS
These events are handled by plugins. See Sprocket::Plugin.
- local_accept
 - local_connected
 - local_receive
 - local_disconnected
 - local_time_out
 - local_error
 - local_shutdown
 
SEE ALSO
POE, Sprocket, Sprocket::Connection, Sprocket::Plugin, Sprocket::Client, Sprocket::Server::PreFork, Sprocket::Server::UNIX, Sprocket::Logger::Basic, Sprocket::Logger::Log4perl
AUTHOR
David Davis <xantus@cpan.org>
RATING
Please rate this module. http://cpanratings.perl.org/rate/?distribution=Sprocket
COPYRIGHT AND LICENSE
Copyright 2006-2007 by David Davis
See Sprocket for license information.