########## #this is the bit that bugs out, afaik ########## #enter select group read wait loop my @ready_sockets; while (@ready_sockets = $select_group->can_read) { #for each socket..... foreach my $sock (@ready_sockets) { #pull data from the socket my $data = <$sock>; #if the data is null, socket is closed if (!($data)) { print "socket closed\n" if $debug; #pull it out of the select group $select_group->remove($sock); $sock->close; return; } print "socket replied: $data" if $debug; if (substr($data,0,4) eq "PING") { print "pong" . substr($data,4); print $sock "PONG" . substr($data,4); } } }