title: Correct pattern for ZeroMQ Server/Client type
body: <p>I have a server that needs to get instructions to run processes for clients on another machine.</p>
  
  <p>The clients send a job message, the Server processes the job and later sends the back results.</p>
  
  <p>I tried using the NetMQ Request-Response pattern (see below)</p>
  
  <p>This works nicely for 1 client, BUT if a second client sends a request before previous client job is finished - I get an error.</p>
  
  <p>I really need to be able to receive ad-hoc messages from clients, and send results when they are completed. Clearly, I am using the wrong pattern, but reading the ZeroMQ docs has not highlighted a more appropriate one.</p>
  
  <pre><code>namespace Utils.ServerMQ
  {
      class ServerMQ
      {
          public static void Go()
          {
              using (var responseSocket = new ResponseSocket("@tcp://*:393"))
              {
                  while (true)
                  {
                      Console.WriteLine("Server waiting");
                      var message = responseSocket.ReceiveFrameString();
  
                      Console.WriteLine("Server Received '{0}'", message);
  
                      //System.Threading.Thread.Sleep(1000);
                      var t2 = Task.Factory.StartNew(() =&gt;
                      {
                          RunProcMatrix(message, responseSocket);
                      });
  
                  }
              }
          }
  
          public static void RunProcMatrix(object state, ResponseSocket responseSocket)
          {
              var process = new Process
              {
                  StartInfo = new ProcessStartInfo
                  {
                      FileName = Path.Combine(@"H:\Projects\Matrix\Matrix\bin\Debug\", "Matrix001.exe"),
                      Arguments = (string)state,
                      WindowStyle = ProcessWindowStyle.Normal,
                      CreateNoWindow = false
                  }
              };
              process.Start();
              process.WaitForExit();
  
  
              responseSocket.SendFrame((string)state);
          }
      }
  }
  </code></pre>