From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Sassmannshausen Newsgroups: gmane.lisp.guile.user Subject: Re: Unix Domain Sockets and (write) (read) Date: Fri, 05 Jul 2013 00:05:43 +0200 Message-ID: <87txkaugjs.fsf@honeybear.home> References: <87y59o61c4.fsf@honeybear.home> 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 1372971986 18581 80.91.229.3 (4 Jul 2013 21:06:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Jul 2013 21:06:26 +0000 (UTC) Cc: guile-user To: Aleix Conchillo =?utf-8?Q?Flaqu=C3=A9?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jul 04 23:06:26 2013 Return-path: Envelope-to: guile-user@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 1UuqjR-0005al-Bu for guile-user@m.gmane.org; Thu, 04 Jul 2013 23:06:25 +0200 Original-Received: from localhost ([::1]:48316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqjQ-0002m8-Nz for guile-user@m.gmane.org; Thu, 04 Jul 2013 17:06:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqjF-0002m2-FL for guile-user@gnu.org; Thu, 04 Jul 2013 17:06:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuqjE-0003UC-J9 for guile-user@gnu.org; Thu, 04 Jul 2013 17:06:13 -0400 Original-Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:59193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqjE-0003Tw-Cu for guile-user@gnu.org; Thu, 04 Jul 2013 17:06:12 -0400 Original-Received: by mail-ea0-f182.google.com with SMTP id d10so1075521eaj.13 for ; Thu, 04 Jul 2013 14:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=ekD5eJNbTLknEKIsD6+b4gqVTFRBhgFKe2u0Jth/qZE=; b=VIS3irqKO2tadx1cP1Ncq0bV1zptm7YkgH2qooDg7iYmAnhDrUnSoJDqfHyS6LMrBt QDHaHsxl/stm9kTfxHG2OiWeiQj56k9UKnvB2iNHkXGSoX11x2PL0AKhOKHF1iG/55ge dLuY/eE3RNHwZKZoSYbqkH3kw20axMaOOlT6LGD3AErWp+n21WNNh/ZV5FGgt4eD4M+K rwjLDhEq6LbGURw2gKEJ8yUmHpmW+ik4clJ3Qux18PUHATxCkFgGUE/x5pxfY93HFBh2 k2w5FgkFT9e1OlQ1uGR5dx9nH2mLJGvNUIkLzgmHzJQV9wQkqpQNOaPDmppNNCcv05Jn h3lw== X-Received: by 10.14.103.196 with SMTP id f44mr8704836eeg.37.1372971971344; Thu, 04 Jul 2013 14:06:11 -0700 (PDT) Original-Received: from honeybear.home ([81.168.71.125]) by mx.google.com with ESMTPSA id n42sm8042654eeh.15.2013.07.04.14.06.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Jul 2013 14:06:10 -0700 (PDT) In-Reply-To: ("Aleix Conchillo \=\?utf-8\?Q\?Flaqu\=C3\=A9\=22's\?\= message of "Tue, 2 Jul 2013 15:57:08 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::236 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10503 Archived-At: Hello again, Aleix Conchillo Flaqu=C3=A9 writes: > On Tue, Jul 2, 2013 at 3:31 PM, Alex Sassmannshausen > wrote: >> >> My question is simply: is this supposed to happen? Would I somehow need >> to close and re-open the socket to have a two-way conversation between >> the client and the server (e.g. client writes request, closes the socket, >> server reads from socket, evaluates, client re-connects, server provides >> response)? >> > > I think that the answer is yes. It is supposed to happen with the code > you provided. > > When the server calls (write) you should flush the port (force-output) > so data gets immediately sent to the client, if that's what you want. Ah, so that is the missing piece in the puzzle. Thanks for your response. > > For the two-way conversation, you simply need to keep on calling > (read) and (write) wherever you want in the server and/or client and > not close the socket until you are really done. In the meantime I've also figured out that read-line and write-line allows me to have this 2-way conversation=E2=80=A6 I'm thinking of writing a summary of my attempts as a novice in socket communications with an example of Unix domain sockets in action. Do people think that something like that might also be a useful addition to the network chapter in Guile's manual? Or is the Examples section kept quite brief on purpose? Best wishes, Alex