How to use k () function to receive data in kdb / q
Using the c.cs interface found in Interoperating with C # , how to use a function k()
to get data from a long - temptation to compute?
What I would like to do is
conn.ks("compute_long_running_function[]");
Do something else
results=conn.k();//wait for data
However, this last call does not return the last result - it will time out indefinitely if /T {N}
not set beforehand.
Is there a way to send data from the server to the client waiting for it? How else can you use a function k()
without arguments.
Please note that this question is also about java interface which is almost identical.
source to share
The k () function will block until it receives data from the remote socket. So if your function looks like this:
compute_long_running_function:{[] r:til 1000; neg[.z.w] r }
the result of the function will be sent over the loopback and obtained by conn.k ()
The alternative is simply:
results=conn.k("compute_long_running_function[]");
which will return the results of the function when they are ready. But you probably already knew that.
Hello,
David
source to share