Home

KDB+ q tips and tricks that I have used

KDB+ q process listening on port and dynamic port allocation

In KDB+ q, the \p command is used to set the port on which the q process listens for incoming connections.

Usage Example:

To set the port to 1234, use the following command:

q)\p 1234

To check the currently set port, simply enter:

q)\p

If the port has been set to 1234, the output will be:

1234i

If no port is set, the command will return 0.

Additional Method:

You can also set the port during the startup of the q process using the -p parameter. For example:

bashCopy codebash>q -p 1234

Tip:

If the specified port (1234) is already in use by another process, you may encounter an error: “port is already in use.” To automatically assign a free port within a range, you can use:

q)\p 1234/1300

This will assign the first available port within the specified range.


Posted

in

by