title: How to receive data with ZeroMQ?
body: <p>I have a simple application which sends and receives data. </p>
  
  <pre><code>ZSocketExample client = new ZSocketExample("127.0.0.1:5555");
  client.send("test");
  </code></pre>
  
  <p>This is my client class:</p>
  
  <pre><code>public class ZSocketExample:IDisposable
  {
      public delegate void ReceiveEventHandler(object sender, SocketEventArgs e);
  
      public event ReceiveEventHandler ReceiveEvent;
      private ZmqContext zmqContext;
      private ZmqSocket zmqSocket;
      private string host;
      private bool isRunning;
      private bool disposed = false;
  
      public ZSocketExample(string host)
      {
          try
          {
              zmqContext = ZmqContext.Create();
              zmqSocket = zmqContext.CreateSocket(SocketType.DEALER);
              ZHelpers.SetID(zmqSocket, Encoding.UTF8);
              zmqSocket.Connect(host);
              this.isRunning = true;
  
              zmqSocket.ReceiveReady += new EventHandler&lt;SocketEventArgs&gt;(zmqSocket_ReceiveReady);
              zmqSocket.SendReady += new EventHandler&lt;SocketEventArgs&gt;(zmqSocket_SendReady);
  
              Poller poller = new Poller(new List&lt;ZmqSocket&gt; { zmqSocket });
  
              while (isRunning)
              {
                  poller.Poll(TimeSpan.FromSeconds(5));
              }
          }
          catch (Exception ex)
          {
              Console.WriteLine(ex.Message);
          }
      }
  
      void zmqSocket_ReceiveReady(object sender, SocketEventArgs e)
      {
          Console.WriteLine("Receive Ready");
      }
  
      void zmqSocket_SendReady(object sender, SocketEventArgs e)
      {
          Console.WriteLine("Send Ready");
      }
  
      public void send(string msg)
      {
          zmqSocket.Send(msg, Encoding.UTF8);
  
          if (ReceiveEvent != null)
              ReceiveEvent(this, null);
      }
  
      public void Dispose()
      {
          Dispose(true);
          GC.SuppressFinalize(this);
      }
  
      protected virtual void Dispose(bool disposing)
      {
          if (disposed)
              return;
  
          if (disposing)
          {
              close();
          }
  
          disposed = true;
      }
  
      public void close()
      {
          isRunning = false;
          zmqSocket.Linger = TimeSpan.FromSeconds(1);
          zmqSocket.Close();
          zmqContext.Terminate();
      }
  }
  </code></pre>
  
  <p>But somehow it doesnot send or receive. Can someone tell me what do I do wrong? And this example blocks the main application. how can I make it non blocking?</p>