unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: "Jan Synáček" <jan.synacek@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Reading data from a file descriptor
Date: Sun, 15 Nov 2015 07:05:27 -0500	[thread overview]
Message-ID: <CAJ=Rwfa7B3n650MraABZWD=LBRgMWwyLgg65u+W36uCtT1Z3RA@mail.gmail.com> (raw)
In-Reply-To: <CACA+5f16VxMwVbS4dYaJB7WfJLfH7qwCnWz5hhhObZh6g7H+0A@mail.gmail.com>

On Sun, Nov 15, 2015 at 6:09 AM, Jan Synáček <jan.synacek@gmail.com> wrote:
> On Fri, Nov 13, 2015 at 9:45 PM, Thompson, David
> <dthompson2@worcester.edu> wrote:
>> On Fri, Nov 13, 2015 at 3:41 PM, Jan Synáček <jan.synacek@gmail.com> wrote:
>>>
>>> I have an open fd to a unix socket and I want to read data from it. I
>>> know that the data is going to be only strings, but I don't know the
>>> length in advance. The good thing about using read-string!/partial is,
>>> that I don't have to specify how many bytes I want to read and it does
>>> the right thing. If you point me to a better direction, I'll be
>>> grateful. I came up with:
>>>
>>> (for-each (lambda (fd)
>>>             (let* ((buf (make-string 4096)))
>>>               (read-string!/partial buf (fdes->inport fd))
>>>               (format #t "fd[~a]: ~a" fd buf) (newline)))
>>>           fds)
>>>
>>
>> Maybe 'read-string' in (ice-9 rdelim) is what you're after.
>>
>> - Dave
>
> For some reason, 'read-string' blocks when I don't specify a small enough limit.

That's how I/O operations work.  'read-string' blocks until the end of
file.  Guess I misunderstood what you're after.

- Dave



  reply	other threads:[~2015-11-15 12:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07 14:52 Reading data from a file descriptor Jan Synáček
2015-11-07 15:16 ` Artyom Poptsov
2015-11-07 15:29   ` Artyom Poptsov
2015-11-07 23:49     ` Andreas Rottmann
2015-11-09  7:25       ` Jan Synáček
2015-11-13 15:51         ` Mark H Weaver
2015-11-13 20:41           ` Jan Synáček
2015-11-13 20:45             ` Thompson, David
2015-11-15 11:09               ` Jan Synáček
2015-11-15 12:05                 ` Thompson, David [this message]
2015-11-16 10:54             ` Amirouche Boubekki
2015-11-17  9:53               ` tomas
2015-11-17 12:59                 ` Chris Vine
2015-11-17 12:52                   ` tomas
2015-11-17 13:55                     ` Chris Vine
2015-11-17 13:33                       ` tomas
2016-06-20 10:40                       ` Andy Wingo
2016-06-20 10:58                         ` tomas
2015-11-18  8:28                   ` Jan Synáček
2015-11-16 13:02           ` tomas
2015-11-23 21:07             ` Andreas Rottmann
2015-11-24 15:28               ` tomas

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='CAJ=Rwfa7B3n650MraABZWD=LBRgMWwyLgg65u+W36uCtT1Z3RA@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=guile-devel@gnu.org \
    --cc=jan.synacek@gmail.com \
    /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).