From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Thompson, David" Newsgroups: gmane.lisp.guile.devel Subject: Re: Reading data from a file descriptor Date: Fri, 13 Nov 2015 15:45:47 -0500 Message-ID: References: <87a8qpx2kg.fsf@elephant.savannah> <874mgxx1y3.fsf@elephant.savannah> <87fv0h1ic2.fsf@delenn.home.rotty.xx.vu> <87h9kpvqw1.fsf@netris.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447447570 2877 80.91.229.3 (13 Nov 2015 20:46:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Nov 2015 20:46:10 +0000 (UTC) Cc: Mark H Weaver , guile-devel To: =?UTF-8?B?SmFuIFN5bsOhxI1law==?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Nov 13 21:45:59 2015 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZxLEG-0005IG-Tv for guile-devel@m.gmane.org; Fri, 13 Nov 2015 21:45:53 +0100 Original-Received: from localhost ([::1]:55161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxLEG-0001aR-11 for guile-devel@m.gmane.org; Fri, 13 Nov 2015 15:45:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxLEC-0001aJ-Uy for guile-devel@gnu.org; Fri, 13 Nov 2015 15:45:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxLEB-0004XB-W6 for guile-devel@gnu.org; Fri, 13 Nov 2015 15:45:48 -0500 Original-Received: from mail-yk0-x236.google.com ([2607:f8b0:4002:c07::236]:36788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxLEB-0004X1-MS for guile-devel@gnu.org; Fri, 13 Nov 2015 15:45:47 -0500 Original-Received: by ykdr82 with SMTP id r82so167528662ykd.3 for ; Fri, 13 Nov 2015 12:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=worcester_edu.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=nDqM/ToRslRGUTGnIhGfEdaRtzbhO9FUxDff1hMMubY=; b=hWP6OsMDZS/W5KVKqfKsGNjy8EKKI7rU3CMHs22Va2jD1RN/gTc1H9evGilv9vm2c1 fXMUY6Tu/Mff/VBzkKb7fSZO+2WOluGmorudgBMPl+m9hFYmJles81j4Zlj0ppWTeEPr GbJjSR9LFv6HUxmVOwmCHStN0jRSUC+T11xIhnI97l/IqfWmjA+ngoaRMIVQz5z6N0PI dWvIaz0gcn/dVRd6SIm4y3lEAhxfekYHaGQ1whj/R44RgSH8gFea0S5gfbwsHBKnTj5f 1qpB77WwG+9YCrkEZzm0uCUdlNh30prnH2Y93b2uI/NbEW5ghO/Y3XsMb0NMg0kutKID LGbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=nDqM/ToRslRGUTGnIhGfEdaRtzbhO9FUxDff1hMMubY=; b=WhyGv9fjvMFbjk63imUuwYVTrmSIMpwc1zLOlsX5knvw1w7vVBDy4onZVD60BVNRLj fgB8Cca4qUr11uz90MAGqGsJlsb/B8Y6Zhihh4EcmfDJy/sKNVhXCIn4LNiFIaUj4G3y Ef1/sdnrNmioOXFXQswmoums+kwYqxCpz2Y1HQOfgH2sKB+b1iboq7ZmU8wGyy7+mhLx CtKANIM8/zHGVwDtJKcd7cWgWyo5Xd1Qadxm0meBILlpRYZcLWR7S3S8u10KD5mDYFdh rAKw0I2LQIH/lhmfdYG9u1RCGnS7xgHeBiAxWQm5unwhLOAKHJfMfDcXVbWOiW//iQEV dqNw== X-Gm-Message-State: ALoCoQkrh/54Q6Xu9Ov9QeJUh2JGwOl7jkNuyPYRoBZeKo3hQPKS/g7TtWK7b/jYWNDS4p/QPpwn X-Received: by 10.13.237.129 with SMTP id w123mr23445080ywe.319.1447447547142; Fri, 13 Nov 2015 12:45:47 -0800 (PST) Original-Received: by 10.37.1.7 with HTTP; Fri, 13 Nov 2015 12:45:47 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::236 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:18019 Archived-At: On Fri, Nov 13, 2015 at 3:41 PM, Jan Syn=C3=A1=C4=8Dek 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