Finding clients connected .z.W - Kdb+ / qStudio

Home Forums Kdb+ / qStudio Finding clients connected .z.W

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #138

    Oskar Morgenstern
    Guest

    I know .z.W lists the handles for connected clients, how can I find their details?

    e.g.
    When I connect using qstudio I see one handle 392 which is obviously just me. If I was at the console how would I get details on that 392 handle? Host, port, username? For every connected client?

    #154

    Ryan Hamilton
    Keymaster

    hi,

    There are a few special variables when communicating between kdb processes using IPC:
    http://www.timestored.com/kdb-guides/interprocess-communication#impvars

    .z.w – When called inside a synchronous call, gives the return handle back to the caller.
    .z.a – Returns the current IP address, if called inside a remote call this will be the remote IP address.
    .z.u – Return the current users name, if called inside a remote call this is the name supplied when the connection was created.
    You could also query each of the handles querying the usual variables, system “p” to get the port etc. Though I would be careful doing that as if the remote process is not a kdb process it is possible that it will crash. e.g.


    q){("." sv string "i"$0x0 vs .z.a;.z.u)} each .z.W
    408| "192.168.0.4" `ryan
    412| "192.168.0.3" `admin

    Alternatively you could log the details of each user as they connect or disconnect by overriding the event handlers. A full example can be found at:
    http://code.kx.com/wiki/Contrib/UsingDotz

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.