> Are you using read, readline (aka <>) or eof? Those aren't compatible with select. You need to use sysread.
Good point.
Reminded me of this old node, an example of a complete event-driven Perl server using IO::Select.
From its source code:
# -----------------------------------------------------------------
# Perl network programming notes
# ------------------------------
# Reading can be done with:
# 1) <$sock> - blocks till new line
# 2) read($sock, $buf, $len) - blocks till $len bytes received
# (like W Richard Stevens readn function
+ in C)
# 3) sysread($sock, $buf, $len) - may return less than asked for
# (like read()/recv() in C)
# -------------------------------------------------------
...
# This one blocks until newline received.
# $data = <$client>;
# This one blocks till $len bytes received (like Stevens readn fun
+ction in C)
# my $hdr;
# my $hdrlen = read( $client, $hdr, $SYSLOG_HDR_LEN );
# This one may return less than asked for (like read()/recv() in C)
my $msglen = sysread( $client, $data, $SYSLOG_MAX_MSG_LEN );
Given the commenting out above, I presumably tried all three at the time before settling on sysread. :)
| [reply] [d/l] [select] |