Go to the source code of this file.
This file contains documentation about socket implementations for libkarmaclient. Concrete socket implementations included with this library are found in ks_socket_posix.c.
We suggest starting with a timeout of 1 second, and treble it for 3 retries, to finish with a timeout of 9 seconds. See also ks_socket_ask().
If you stream requests at high speed over a socket, the server may send responses back over a socket in a different order to order in which the requests were sent. This applies to both TCP and UDP modes.
If you wait for each response on a particular socket before sending the next query, then you can nearly lock-step the queries, but if a response is apparently "lost", it may still appear later, so this strategy is not totally reliable.
There is packet reordering code in ks_socket_posix.c which sorts this out. There is also a "simple version" (lines 570-591) in a comment which is a non-pthread explanation of the more complex code below.
Definition in file ks_socket.c.
1.4.4