Subject: | When select says the socket has data to read, but sysread is unable to read from the handle. |
Perl 5.8.8
$Id: http.pm,v 1.70 2005/12/08 10:28:01 gisle Exp $
Linux www6.dmz.example 2.6.18-164.15.1.el5.028stab068.9 #1 SMP Tue Mar
30 18:07:38 MSD 2010 i686 i686 i386 GNU/Linux
In Bug #14028 OP asks:
We create three IO::Select objects in the same way but each object
is slightly bigger than the last. Surely each object should be the same
size? The same behavior occurs on either Win32 or Solaris.
Graham Barr answers that
That is because IO::select uses the system file number of the handle
passed to store the filehandle reference in an array. So the array
object will be as big as the file number of the filehandle passed in.
Now, when the file numer of the filehandle is Zero, I get a 500 EOF file
like on this forum post, http://www.perlmonks.org/?node_id=543006
The solution is to duplicate the line below
my $socket = $self->_new_socket($host, $port, $timeout);
as
$socket = $self->_new_socket($host, $port, $timeout);
and then the code works.
This is my first bug report to CPAN, so please bear with me if you
require more information.
Regards,
Andy