Good point ++dws. I tried stepping by 1 (since 130171 is prime :-/) and it worked. I came back after doing a little work solving a stupid math error on my part with this code:
... my $readamount = int(($length - $got_so_far)/8192)?8192:$length-$g +ot_so_far; while ( ($got_so_far < $length) and read( $sock, $buffer, $readamo +unt ) ){ print $fh $buffer; $got_so_far += length $buffer; $readamount = int(($length - $got_so_far)/8192)?8192:$length-$ +got_so_far; print "Got: $got_so_far\n" if $DEBUG; } ...
and you had already made the points I was going to make. However, to the OP: Hope this helps.
Update: Thanks to dws for pointing out a possible block situation. Note to the OP that the read under init_download should probably choose a smaller chunk to be read. Of course, you could also just use sysread. :)
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: Re: read aka fread(3) broken, sysread aka read(2) works IIS socket
by antirice
in thread read aka fread(3) broken, sysread aka read(2) works IIS socket
by tachyon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |