[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unix Domain Sockets and (write) (read)
From: |
Alex Sassmannshausen |
Subject: |
Re: Unix Domain Sockets and (write) (read) |
Date: |
Fri, 05 Jul 2013 00:05:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Hello again,
Aleix Conchillo Flaqué <address@hidden> writes:
> On Tue, Jul 2, 2013 at 3:31 PM, Alex Sassmannshausen
> <address@hidden> 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…
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