Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: IO::Handle read error description?

by ikegami (Pope)
on Apr 28, 2010 at 17:56 UTC ( #837362=note: print w/replies, xml ) Need Help??

in reply to Re^2: IO::Handle read error description?
in thread IO::Handle read error description?

No. The whole point of using select is to let us know when reading from the socket won't block and when writing to the socket won't block.

Unfortunately, it doesn't tell us how much we can write to it without blocking. We only know that we can write one byte without blocking. Maybe non-blocking sockets would help in the writing half. Ideally, there would be a system call that tells us how much we can write without writing. I don't know if there is one.

Replies are listed 'Best First'.
Re^4: IO::Handle read error description?
by vsespb (Chaplain) on Apr 28, 2010 at 18:56 UTC
    I was thinking sysread(... 4096 ... will block until read all 4096 bytes...
      It will return whatever bytes are available.
      $ perl -e'$|=1; print "a"; print "b"; sleep 1; print "c"' | \ perl -le'print "[$buf]" while sysread(STDIN, $buf="", 4096);' [ab] [c]

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://837362]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-07-04 22:11 GMT
Find Nodes?
    Voting Booth?

    No recent polls found