Back to Message Handlers (.z Namespace)

Interprocess Communication (IPC) · Message Handlers (.z Namespace) · Practice Question

Identify the Calling Process Inside a Handler

Sign in to track your progress

Question

From inside a message handler like .z.pg, .z.ps, or .z.po, how can a process find out which connection a request came in on, what IP address it came from, and which username was used to authenticate?

Solution

.z.w    / handle of the connection the current message arrived on
.z.a    / IP address of the calling process
.z.u    / username supplied when the connection was authenticated

Explanation

All three are populated automatically by q, and only hold meaningful values while a remote message is actively being handled.

.z.w is the handle pointing back at the caller — used to reply or send a callback, as in neg[.z.w](...), without needing to know in advance who's asking.

.z.a and .z.u are typically used for logging and access control: a custom .z.pg might log every request's IP and username, or use .z.u to check a caller's permissions before honouring their request — the same idea as the function whitelist, keyed on who rather than what.