Socket specifications?
Friday, 20 January 2023 · 3 messages · last reply 21 Jan 2023
BE
Ben Engbers20 Jan 2023 18:31 #
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
LQ
Liam R. E. Quin20 Jan 2023 20:23 #
Quoted text · Ben Engbers · 4 lines
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_sockets/ 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/
BE
Ben Engbers21 Jan 2023 14:18 #
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
Quoted text · Ben Engbers · 5 lines
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
Written for BaseX 10.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery