OZAWA,

 I am not able to replicate this behaviour. If I start the server your
server with a sleep(60) instead of the sleep(1), and then fire multiple
clients against this server, all clients get queued up with a ~60sec delay
between each client. The /*do work*/ payload of your main loop is
sequential.  As I understand IO is handled by independent IO threads but
that doesn't automatically "parallelize" your application itself.

regards
srp

On Fri, Nov 4, 2011 at 11:21 AM, Tsuyoshi OZAWA <[email protected]>wrote:

> Hi,
>
> I'm trying to use 0MQ in REQ/REP mode.
> A question came appeared when I writing server-side code with RES 0MQ
> socket.
> My question is : why the blocking sockets in 0MQ can handle multiple
> clients?
>
> For example, there is a very simple server code :
>    while (1) {
>            //  Wait for next request from client
>            zmq_msg_t request;
>            zmq_msg_init (&request);
>            zmq_recv (responder, &request, 0);
>            printf ("Received Hello\n");
>            zmq_msg_close (&request);
>
>            //  Do some 'work'
>            sleep (1);
>
>            //  Send reply back to client
>            zmq_msg_t reply;
>            zmq_msg_init_size (&reply, 5);
>            memcpy (zmq_msg_data (&reply), "World", 5);
>            zmq_send (responder, &reply, 0);
>            zmq_msg_close (&reply);
>    }
>
> I thought that this code cannot handle multiple clients, but it can handle
> them.
> It's very cool feature, however, I wonder why this code can handle
> multiple clients.
> With standard socket(),  we have to use multiplexing IO (such as
> epoll, kqueue, and so on).
> What's happning inside 0MQ?
>
> Best Regards,
> OZAWA Tsuyoshi
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
Idea Device
Automation Technologies
www.ideadevice.com
+91 9945196516
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to