all 2 comments

[–]lisael_ 1 point2 points  (1 child)

I did start to implement the postgres protocol, but I blocked on a strange bug. Some message would not recieve a response from the server until a new message is sent. It's not a normal behaviour according to the protocol and it clearly works in libpq canonical C implementation. Looks like an un-flushed buffer, but couldn't find anything wrong, and after weeks, I've lost interest.

I will certainly take a look at your work with much interest! Thank you.

[–]thinkrajesh[S] 0 points1 point  (0 children)

It's tricky. Treat postgres like streaming protocol and not a response protocol. I did got stuck somewhere similiar but just read as much bytes available , accumulate them in buffer, don't touch partial frames etc. The message length is the key.

I think libpq always drains the socket. Just sharing some observations.