[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unix Domain Sockets and (write) (read)
From: |
Aleix Conchillo Flaqué |
Subject: |
Re: Unix Domain Sockets and (write) (read) |
Date: |
Tue, 2 Jul 2013 15:57:08 -0700 |
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.
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