Tips on TCP socket to postgresql middleware

eugene dee0xeed at
Thu Feb 24 09:11:01 UTC 2022

On Thursday, 24 February 2022 at 08:46:35 UTC, eugene wrote:
> On Saturday, 19 February 2022 at 20:13:01 UTC, Chris Piker 
> wrote:
>> 3. Update/insert to a postgresql database as data arrive.
> I've remembered one not so obvious feature of TCP sockets 
> behavour.
> If the connection is closed on the server side
> (i.e. on the client side the socket is in CLOSE_WAIT state),
> **write() will not fail**, and data will go to no nowhere.

In my case (I was working with REDIS KVS at the moment)
exact scenario was as follows:

* prog gets EPOLLOUT (write() won't block)
* prog writes()'s data to REDIS ("successfully")

After this I see that I need to reconnect, but I've already send
some data which had gone to nowhere.

People sometimes recommend using usual non-blocking sockets,
but it is not the case.

More information about the Digitalmars-d-learn mailing list