[zeromq-dev] equivalent of accept

Martin Sustrik sustrik at 250bpm.com
Sun Apr 25 15:58:13 CEST 2010


Varol Okan wrote:

>> I think there's a conceptual gap here. 0MQ is not connection based,
>> it's message based. Forget about connections. There are none -- at
>> least from user's point of view. Instead, there are messages.
>> 
>> In your case it means there's no way to authenticate a connection.
>> You have to authenticate a message.
> 
> Hahaha, I feel like I was sitting in a dark room until some one
> turned on the light :) Sorry for that, as I said I am starting out
> with 0MQ.

:)

> Anyhow, one last question remains wrt to the client. Since 0MQ is
> message based, how can I determine if the host is alive or simply
> busy doing things.
> 
> Example: for a socket of type  zmq::socket_t socket ( ctx, ZMQ_REQ );
> 
> 
> If I do socket.send ( query ); followed by socket.recv ( &result );
> 
> How do I handle a fault like server crashed, or some one pulled the
> plug. Is there a timeout I can set or would the client freeze ? What
> can I do to gracefully handle these types of fault ?

If a service crashes, 0MQ will remove it from it's load-balancing 
mechanism. Thus messages will be sent to other service instances. If 
there are no other instances, messages will be queued and sent to the 
service once it is restarted.

Martin



More information about the zeromq-dev mailing list