POE::Component::IKC::Server - POE Inter-kernel Communication server
This module implements a POE IKC server. A IKC server listens for incoming connections from IKC clients. When a client connects, it negociates certain connection parameters. After this, the POE server and client are pretty much identical.
Deprecated. Use "spawn" in POE::Component::IKC::Server.
This methods initiates all the work of building the IKC server. Parameters are :
Address to listen on. Can be a doted-quad ('127.0.0.1') or a host name ('foo.pied.nu'). Defaults to '0.0.0.0', aka INADDR_ANY.
Port to listen on. Can be numeric (80) or a service ('http'). If undefined, will default to 603. If you set the port to 0, a random port will be chosen and spawn will return the port number.
my $port = POE::Component::IKC::Server->spawn( port => 0 );
warn "Listeing on port $port";
Path to the unix-socket to listen on. Note: this path is unlinked before socket is attempted! Buyer beware.
Local kernel name. This is how we shall "advertise" ourself to foreign kernels. It acts as a "kernel alias". This parameter is temporary, pending the addition of true kernel names in the POE core. This name, and all aliases will be registered with the responder so that you can post to them as if they were remote.
Arrayref of even more aliases for this kernel. Fun Fun Fun!
Print extra information to STDERR if true. This allows you to see what is going on and potentially trace down problems and stuff.
Activates the pre-forking server code. If set to a positive value, IKC will fork processes-1 children. IKC requests are only serviced by the children. Default is 1 (ie, no forking).
Time, in seconds, between invocations of the babysitter event.
Number of connections a child will accept before exiting. Currently, connections are serviced concurrently, because there's no way to know when we have finished a request. Defaults to 1 (ie, one connection per child).
Number of simultaneous connected clients allowed. Defaults to 0 (unlimited).
Note that this is per-IKC::Server instance; if you have several ways of connecting to a give IKC server (for example, both an TCP/IP port and unix pipe), they will not share the conncurrent connection count.
Which IKC negociation protocol to use. The original protocol (IKC) had a slow synchronous handshake. The new protocol (IKC0) sends all the handshake information at once. IKC0 will degrade gracefully to IKC, if the client and server don't match.
Default is IKC0.
Coderef that is called for all errors. You could use this to monitor for problems when forking children or opening the socket. Parameters are $operation, $errnum and $errstr, which correspond to POE::Wheel::SocketFactory's FailureEvent, which q.v.
$operation, $errnum and $errstr
However, IKC/monitor provides a more powerful mechanism for detecting errors. See POE::Component::IKC::Responder.
Note, also, that the coderef will be executed from within an IKC session, NOT within your own session. This means that things like $poe_kernel->delay_set() won't do what you think they should.
POE::Component::IKC::Server::spawn returns undef(), unless you specify a "port"=0, in which case, spawn returns the port that was chosen.
This event causes the server to close it's socket, clean up the shop and head home. Normally it is only posted from IKC::Responder.
Preforking is something of a hack. In particular, you must make sure that your sessions will permit children exiting. This means, if you have a delay()-loop, or event loop, children will not exit. Once POE gets multicast events, I'll change this behaviour.
Philip Gwyn, <perl-ikc at pied.nu>
Copyright 1999-2014 by Philip Gwyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::IKC, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.