On Fri, Nov 13, 2015 at 9:45 PM, Thompson, David
<dthomps...@worcester.edu> wrote:
> On Fri, Nov 13, 2015 at 3:41 PM, Jan Synáček <jan.syna...@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.

-- 
Jan Synáček

Reply via email to