Confused by sysread()
Dirk Koopman
djk at tobit.co.uk
Tue Apr 10 11:02:31 BST 2012
On 09/04/12 22:32, Roger Burton West wrote:
> while (1) {
> my @ready=$s->can_read(0.5);
> foreach my $fh (@ready) {
> my $data;
> my $y=sysread $fh,$data,16;
> die $! unless defined $y;
> # do stuff with $data
> }
> }
>
For what it is worth, I am running a similar loop which will call
sysread, but with an extra offset parameter as in:
my $y=sysread $fh,$data,16,0;
I believe I did this for similar reasons as early as perl 5.0004. But
this may be complete misremembering on my part as it was more than 12
years ago. My version of this code is still running very happily on perl
5.10.1, but on sockets and in non-blocking mode.
More information about the london.pm
mailing list