in reply to Re^2: How to pass AnyEvent socket handle to pre-forked child process?
in thread How to pass AnyEvent socket handle to pre-forked child process?
You can use accept, you just should ensure that it will not block. Make server socket non-blocking, add read watcher to it, in read callback accept all connections. Something like:
use AnyEvent::Util qw(fh_nonblocking); ...; fh_nonblocking $srv_sock, 1; my $w = AE::io $srv_sock, 0, sub { while(accept my $cli_sock, $srv_sock) { # initialize watchers for client socket } };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: How to pass AnyEvent socket handle to pre-forked child process?
by michaelfung (Novice) on Jan 25, 2013 at 07:56 UTC |
In Section
Seekers of Perl Wisdom