in reply to sysread and syswrite in tcp sockets
If you use sysread you must expect partial reads -- see the fine documentation. (Update: sorry, the documentation doesn't tell you this... I felt sure it did... I feel sure it should. Update 2: I am grateful to brother ikegami for pointing out ( see below) the significance of the word Attempts, which I am ashamed to admit I had missed.)
You could try plain read, which is less "clever".
Or you wrap a loop around the sysread, eg:
which will suck away at FH until it hits eof ($rc == 0) or hits some error (!defined($rc)). (Noting that if the FH is set to be non-blocking you can get "soft" EAGAIN error(s)...)my $rc ; my $buff = '' ; do { $rc = sysread(FH, $buff, 5000000, length($buff)) ; } while ($rc +) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sysread and syswrite in tcp sockets
by ikegami (Patriarch) on Dec 22, 2008 at 17:06 UTC | |
|
Re^2: sysread and syswrite in tcp sockets
by rustybar (Novice) on Dec 22, 2008 at 12:55 UTC | |
by gone2015 (Deacon) on Dec 22, 2008 at 19:24 UTC |