I need to write a server program that will open and keep 5 live Telnet, SSH and various connections to a server, while it listens to JSONRPC calls on the other side.
I've no problem with opening and maintaining the 5 connections, and listening for requests:
# workers:
open_myconnections( 1..5 );
my $w1 = AnyEvent->timer (interval => $seconds, cb => sub { keep_conn_alive(1) });
my $w2 = AnyEvent->timer (interval => $seconds, cb => sub { keep_conn_alive(2) });
...
# now listen for requests
use AnyEvent::JSONRPC::Lite;
# master:
my $server = jsonrpc_server '127.0.0.1', '4423';
$server->reg_cb(
queue_up => sub {
my ($res_cv, @params) = @_;
my $res = send_params_to_connection_queue( @params );
$res_cv->result($res);
},
);
But now I'm stuck trying to figure out the best way (ie the non-blocking, AnyEvent way) to distribute the queue among the 5 workers, which is what my function send_params_to_connection_queue() does.
Any module suggestion is appreciated, although I'm trying to avoid using POE since this is supposed to be a very tiny server and, unless no other sensible option exists, I'll pass.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)