in reply to Socket connected function
My guess, from looking at my own usage of IO::Select, is to modify your while loop like this:
In other words, if reading from the socket got nothing, then it's done. (I use sysread reading from pipes, but shouldn't make a difference.)while(<$new_sock>) { $quit = 1 unless length; print $_; }
Also, inside your foreach loop, you shouldn't use $new_sock, you should use $rh. Makes your code more robust in case you add additional read-sockets into your IO::Select list.
|
|---|