namespaceExamples
{staticpartialclassProgram{staticvoidAsyncSrv_Client(ZContext context, int i){//// Asynchronous client-to-server (DEALER to ROUTER)//// While this example runs in a single process, that is to make// it easier to start and stop the example. Each task has its own// context and conceptually acts as a separate process.//// Author: metadings//

// This is our client task// It connects to the server, and then sends a request once per second// It collects responses as they arrive, and it prints them out. We will// run several client tasks in parallel, each with a different random ID.

staticvoidAsyncSrv_ServerTask(ZContext context){// This is our server task.// It uses the multithreaded server model to deal requests out to a pool// of workers and route replies back to clients. One worker can handle// one request at a time but one client can talk to multiple workers at// once.