Walchy has asked for the wisdom of the Perl Monks concerning the following question:
handle_incoming is called, when a sockets comes in, but handle_client never... I tried reading the socket directly in handle_incoming, which works - so there must be sth. wrong with the 2nd watcher:use IO::Socket; use EV; my $server = new IO::Socket::INET ( LocalPort => 2345, Type => SOCK_STREAM, Listen => SOMAXCONN, Reuse => 1 ); my $w = EV::io $server, EV::READ, \&handle_incoming; EV::loop; sub handle_incoming { my $w=shift; my $h=$w->fh; my $client=$h->accept or die; print "socket connection in...\n"; my $w = EV::io $client, EV::READ, \&handle_client; } sub handle_client { my $w=shift; my $h=$w->fh; $in=<$client>; print "in=$in\n"; }
Anybody any ideas? Thanks in advance and I wish you a great new year!! ;-) Walchymy $w = EV::io $client, EV::READ, \&handle_client;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: EV::io and Sockets
by shmem (Chancellor) on Jan 03, 2009 at 12:44 UTC | |
by Walchy (Initiate) on Jan 04, 2009 at 04:10 UTC |