[zeromq-dev] Socket usage question

Matt Haberman mhaberman at msmnet.com
Wed Aug 24 04:09:40 CEST 2011

I am trying simulate load on a process created with 0MQ (CLZMQ2 binding) and have a question about when to create sockets. My application is listening for requests using an XREP socket. I wrote a little console app to simulate concurrent clients that looks like:

public class Client
    Context context;

    public Client()
        context = new Context(1);
    public void SendRequest()
        for (int i = 1; i <= 1000; i++)
            Task t = new Task(
                () =>
                    Socket r = context.Socket(SocketType.REQ);

                    r.Send("Hello", Encoding.Unicode);
                    string reply = r.Recv(Encoding.Unicode);
                    Console.WriteLine("Received reply {0}", reply);
Frequently, when i run the console app my entire machine freezes and is unresponsive. Is there something wrong with this approach?


More information about the zeromq-dev mailing list