Hi, When I developed the Basex client for R, I ran into problems with the socket for a long time. In the end it turned out that in R I had to configure the socket as a non-blocking socket. This solved all performance issues! I am now trying to develop a client for SWI-prolog. Because that low-level compiler doesn't support using sockets enough, I need to develop a library in C++ first. And in doing so, I again run into problems with the socket. The basex documentation just says to use a socket. But there is no information on how to configure the socket itself. My question is how do I configure the client side of the socket for optimal use? Ben Engbers
On Fri, 2023-01-20 at 18:31 +0100, Ben Engbers wrote:
My question is how do I configure the client side of the socket for optimal use?
Whether reading from a socket is non-blocking is a function of the API you use on the client, not the server end. Likely you can find a C++ library that does what you need; if not, it's usually a matter of arranging your client around a select() loop (or poll() if you prefer). https://www.reddit.com/r/C_Programming/comments/wr5pjs/select_on_nonblocking... has some links to examples, or a Web search for non-blocking socket select example, gets results. liam -- Liam Quin - delightfulcomputing.com Cancer gofundme https://www.gofundme.com/f/5u9v7-every-little-helps Vintage pictures & texts https://www.fromoldbooks.org/
Thanks, In the meantime I have narrowed my problem down to the code that reads from the socket. I'll see if this works better when usen poll() instead of select(). Ben Op 20-01-2023 om 19:20 schreef Liam R. E. Quin:
On Fri, 2023-01-20 at 18:31 +0100, Ben Engbers wrote:
Whether reading from a socket is non-blocking is a function of the API you use on the client, not the server end. I didn't know
participants (3)
-
Ben Engbers -
Ben Engbers -
Liam R. E. Quin