Hi,
I’m trying to write a simple C# program that holds some state and responses to q requests. But I cannot figure out a proper way to write the response code.
Below is a simple POC program that I have right now:
namespace POC
{
class Program
{
static object data = new object
{
“hello”,
(Int32)1234,
“world”
};
static void Main(string args)
{
c c = new c(“localhost”, “11111”);
while (true)
{
object cmd = c.k();
if (cmd is String)
{
String req = (String)cmd;
if (req.Length > 0)
{
switch (req[0])
{
case “getData”:
c.k(data); // This crashes within c!
c.ks(data); // This is invalid, as c.ks expects the first argument to be a string!
// How do I return `data’ to q?!
break;
default:
break;
}
}
}
}
}
}
}
The above code is based on the code in the “Simple subscriber” section of “C# client for kdb+” document. But the sample code provided is for a “pure” subscriber, i.e., C# is not supposed to reply to data published from q. In my case, however, I need to respond to requests from q – How to I send the response?