Interprocess Communication (IPC) · Inspecting Handles · Practice Question
List a Process's Open IPC Handles
Question
If a q process has opened connections to multiple processes, how can you see the list of currently open handle values?
Solution
.z.WExplanation
.z.W is a built-in dictionary mapping every open IPC handle to the bytes currently waiting in its outgoing queue:
q).z.W
q)h:hopen 5001
q)h
5i
q).z.W
5| 0Before opening any connections, .z.W is empty. After hopen 5001 returns handle 5i, .z.W shows entry 5| 0 — open and idle, nothing queued.
Use it for two things: seeing which handles are currently open, and checking whether async messages are sitting unsent in a handle's buffer (see the asynchronous flush question).