unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Marko Rauhamaa <marko@pacujo.net>
Cc: guile-user@gnu.org
Subject: Re: Nonblocking get-bytevector-n bug?
Date: Tue, 08 Dec 2015 10:39:31 -0500	[thread overview]
Message-ID: <87k2opymoc.fsf@netris.org> (raw)
In-Reply-To: <87h9jvuxb3.fsf@elektro.pacujo.net> (Marko Rauhamaa's message of "Sun, 06 Dec 2015 22:38:56 +0200")

Marko Rauhamaa <marko@pacujo.net> writes:

> 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.

While I'm reluctant to guarantee any fixed limit, I can offer this: the
returned bytevector will always be of a manageable size, assuming that
you have not "unread" a huge amount of data, and that you haven't set a
huge buffer size via 'setvbuf'.  In the current implementation, the size
is limited by the read buffer size of the port, or the size of the
"putback" buffer.

If 'get-bytevector-some' returns more data than you want, I would
suggest using 'unget-bytevector' to "unread" the unwanted suffix.  This
procedure is quite efficient.  'unget-bytevector' was introduced in
Guile 2.0.9.

Would this work for you?

     Thanks,
       Mark



  parent reply	other threads:[~2015-12-08 15:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-06 20:38 Nonblocking get-bytevector-n bug? Marko Rauhamaa
2015-12-07  9:50 ` Ludovic Courtès
2015-12-07 10:21   ` Taylan Ulrich Bayırlı/Kammer
2015-12-07 10:58     ` Taylan Ulrich Bayırlı/Kammer
2015-12-07 14:42       ` Ludovic Courtès
2015-12-08 10:53         ` tomas
2015-12-07 10:28   ` Marko Rauhamaa
2015-12-07 11:15     ` Marko Rauhamaa
2015-12-07 12:44 ` Amirouche Boubekki
2015-12-07 12:52   ` Marko Rauhamaa
2015-12-08 15:39 ` Mark H Weaver [this message]
2015-12-08 17:34   ` Marko Rauhamaa
2015-12-08 19:28     ` Chris Vine
2015-12-08 21:51       ` Marko Rauhamaa
2015-12-08 22:02         ` Marko Rauhamaa
2015-12-09  0:52           ` Chris Vine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k2opymoc.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-user@gnu.org \
    --cc=marko@pacujo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).