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"; } #### my $w = EV::io $client, EV::READ, \&handle_client;