From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.user Subject: Re: Unix Domain Sockets and (write) (read) Date: Tue, 2 Jul 2013 15:57:08 -0700 Message-ID: References: <87y59o61c4.fsf@honeybear.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1372805838 23808 80.91.229.3 (2 Jul 2013 22:57:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Jul 2013 22:57:18 +0000 (UTC) Cc: guile-user To: Alex Sassmannshausen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jul 03 00:57:20 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 1Uu9Vf-0006m4-Hi for guile-user@m.gmane.org; Wed, 03 Jul 2013 00:57:19 +0200 Original-Received: from localhost ([::1]:39965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu9Vf-000283-89 for guile-user@m.gmane.org; Tue, 02 Jul 2013 18:57:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu9VX-000277-Vx for guile-user@gnu.org; Tue, 02 Jul 2013 18:57:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu9VX-0007MN-49 for guile-user@gnu.org; Tue, 02 Jul 2013 18:57:11 -0400 Original-Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:62032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu9VW-0007KO-T6 for guile-user@gnu.org; Tue, 02 Jul 2013 18:57:11 -0400 Original-Received: by mail-la0-f44.google.com with SMTP id er20so6236876lab.31 for ; Tue, 02 Jul 2013 15:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XRNvY1uItaR3KBn81C+oae2WP+ldg8h1ARtkSsQubDs=; b=bTKGHD38JEAMsi0AweCc+lMVrR3PbdlcOhUoveZ2ep2o0QWpfoZyMzHNqiTGf3Yc36 9YXWOAbCP/0R1+czQq/UqP49QY3caKwMbVq3O1tfL8qms3TaM4uh/lV2WNoct2XkUinM PdzEuKwldZ9bBnCBiRbmgT9AKwjur+c/JkAWfLvbIllqo36khX5FMuDbG2xq8v1hnpom SCxHVHnlDA+zwG8hhnxryW1Trao3NNpnCwODTcy+AFUIclK5eEV5Y6dfhTayBddR2zT3 8qUa1VBC+W03cw3av5GwxE70zWkyAEBs2CaKtQM/ZZo+DFatwx3T4BoxNsU3wlcG0Tsm G0IA== X-Received: by 10.112.155.161 with SMTP id vx1mr15027099lbb.78.1372805829061; Tue, 02 Jul 2013 15:57:09 -0700 (PDT) Original-Received: by 10.114.173.228 with HTTP; Tue, 2 Jul 2013 15:57:08 -0700 (PDT) In-Reply-To: <87y59o61c4.fsf@honeybear.home> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22c 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:10502 Archived-At: 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. 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. Aleix