[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading data from a file descriptor
From: |
Jan Synáček |
Subject: |
Re: Reading data from a file descriptor |
Date: |
Sun, 15 Nov 2015 12:09:39 +0100 |
On Fri, Nov 13, 2015 at 9:45 PM, Thompson, David
<address@hidden> wrote:
> On Fri, Nov 13, 2015 at 3:41 PM, Jan Synáček <address@hidden> 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.
--
Jan Synáček
- Reading data from a file descriptor, Jan Synáček, 2015/11/07
- Re: Reading data from a file descriptor, Artyom Poptsov, 2015/11/07
- Re: Reading data from a file descriptor, Artyom Poptsov, 2015/11/07
- Re: Reading data from a file descriptor, Andreas Rottmann, 2015/11/07
- Re: Reading data from a file descriptor, Jan Synáček, 2015/11/09
- Re: Reading data from a file descriptor, Mark H Weaver, 2015/11/13
- Re: Reading data from a file descriptor, Jan Synáček, 2015/11/13
- Re: Reading data from a file descriptor, Thompson, David, 2015/11/13
- Re: Reading data from a file descriptor,
Jan Synáček <=
- Re: Reading data from a file descriptor, Thompson, David, 2015/11/16
- Re: Reading data from a file descriptor, Amirouche Boubekki, 2015/11/16
- Re: Reading data from a file descriptor, tomas, 2015/11/17
- Re: Reading data from a file descriptor, Chris Vine, 2015/11/17
- Re: Reading data from a file descriptor, tomas, 2015/11/17
- Re: Reading data from a file descriptor, Chris Vine, 2015/11/17
- Re: Reading data from a file descriptor, tomas, 2015/11/17
- Re: Reading data from a file descriptor, Jan Synáček, 2015/11/18
- Re: Reading data from a file descriptor, tomas, 2015/11/16
- Re: Reading data from a file descriptor, Andreas Rottmann, 2015/11/23