Guile 2.0.11 provides:
get-bytevector-n
get-bytevector-n!
get-bytevector-some
Of these, only get-bytevector-some seems to behave as expected when the
port is nonblocking:
========================================================================
(use-modules (rnrs io ports)
(rnrs bytevectors))
(let ((port (fdes->inport 0)))
(fcntl port F_SETFL (logior O_NONBLOCK (fcntl port F_GETFL)))
(let loop ()
(catch 'system-error
(lambda ()
(format #t "~s\n" (get-bytevector-some port)))
(lambda syserr
(format #t "err ~s\n" (system-error-errno syserr))))
(sleep 1)
(loop)))
========================================================================
If you replace (get-bytevector-some port) with
(get-bytevector-n port 8192) or (get-bytevector-n! port bv 0 8192),
no partial data is returned.
The problem with get-bytevector-some is that there is no limit to how
many bytes might be returned. In practice, I see that the amount is
capped at 4096 bytes, but the documentation does not guarantee any
limit.
Marko