Interprocess Communication (IPC) · Listening on a Port · Practice Question
Start a Server and Client Process on Different Ports
Question
Start two separate q processes — one acting as a server, the other as a client. Have the server listen on port 5001, and the client listen on port 5002.
Solution
q -p 5001 # serverq -p 5002 # clientExplanation
Each process opens its own port via -p independently — listening just makes a process reachable. The actual connection comes later, when the client calls hopen against the server's port.
This server/client pair is the setup used throughout the rest of this section.