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: Sun, 15 Nov 2015 07:05:27 -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 1447657349 16269 80.91.229.3 (16 Nov 2015 07:02:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2015 07:02:29 +0000 (UTC) Cc: guile-devel To: =?UTF-8?B?SmFuIFN5bsOhxI1law==?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Nov 16 08:02:25 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 1ZyDo0-0004Ay-BM for guile-devel@m.gmane.org; Mon, 16 Nov 2015 08:02:24 +0100 Original-Received: from localhost ([::1]:46198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyDnz-0002Ix-Ry for guile-devel@m.gmane.org; Mon, 16 Nov 2015 02:02:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zxw3l-0001za-2r for guile-devel@gnu.org; Sun, 15 Nov 2015 07:05:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zxw3k-0004Lc-4n for guile-devel@gnu.org; Sun, 15 Nov 2015 07:05:28 -0500 Original-Received: from mail-yk0-x236.google.com ([2607:f8b0:4002:c07::236]:35915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zxw3j-0004LY-SL for guile-devel@gnu.org; Sun, 15 Nov 2015 07:05:27 -0500 Original-Received: by ykdr82 with SMTP id r82so201688900ykd.3 for ; Sun, 15 Nov 2015 04:05:27 -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=tvY4SLKGFh1l4W/L+ejPXT3kL8nOHU+UPMFvLyDF/ms=; b=HoILQmGRMUyR31d39FXgE4/iRpIp5TqLy1ypTbXPAe5CisBUQNsHriBPAWalcKD+eb QueiFRxb/LdCXt6bWQLWee5wqHGYzNlIIxv4tTB/sQEk4ZjvTvPAwOQsIdtvnjHbM6Gp b1wjVwX7ept2MBepNabfzxk69YJZQ5YNqXSn1AoEiuUL8DrDDppImE4IkNcPHemNgWyV 86ec04rqSicDkmEbyhMc76nMA4iNA4F5DEKks7/JVS1a7RAkcpk3XAg+Zg/KLd3hv0Sj mRBkAza1fAoRowZAP1UHNWoXcqriRaICwm8oNBn5Cub7sa6hrW6K/eKqAQ82Jb5P0G5U E8lw== 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=tvY4SLKGFh1l4W/L+ejPXT3kL8nOHU+UPMFvLyDF/ms=; b=ZA9L7A7p0JPkVgUZZ7reEMB7sfNmFmm6I0UYGUdo7/3VyPuc0WUUi2+2A2tsvdoa6K u0mgzUW3d6unIFOZ/2nI0xHteToCDj4bk+wqQ0vpXFSZtmKVMrV650FPoXvKnYoTZbCJ MFx74+p55iJmIgm7pAYpUdmfAFfB4yV3GAUb7bjnF16q2mLbyfQyzzQKZyIiOOcQvyYw 25ddAJzr0+OLiD9QPUeOy/kVmCSTVZQzpRO3ka4LDSflaG7/S813wkDD3pHWUMq2+xI0 mTm6JgjYDx6/imjlW5l2FeZ8CVUDNY8QVcjBEslU9jx4km20ukIw6Hr5c1FUo/iMZchD UYog== X-Gm-Message-State: ALoCoQnChmDyU5LpUr607fdhWgCO8vlfs62YXaMgdmqsy0CL7ClVdTKvoCtmYrXm68URn3DVQBFu X-Received: by 10.13.201.131 with SMTP id l125mr21852800ywd.150.1447589127343; Sun, 15 Nov 2015 04:05:27 -0800 (PST) Original-Received: by 10.37.1.7 with HTTP; Sun, 15 Nov 2015 04:05:27 -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:18023 Archived-At: On Sun, Nov 15, 2015 at 6:09 AM, Jan Syn=C3=A1=C4=8Dek wrote: > On Fri, Nov 13, 2015 at 9:45 PM, Thompson, David > wrote: >> 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 > > 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