[zeromq-dev] disconnection / shutdown

Martin Sustrik sustrik at fastmq.com
Thu Mar 12 15:01:43 CET 2009


Aamir,

> #include <zmq.hpp>
> 
> int main()
> {
>   zmq::dispatcher_t*  dispatcher;
>   zmq::locator_t*     locator;
>   zmq::i_thread*      io_thread;	
>   zmq::api_thread_t*  api;
> 
>   int exchangeID;
> 
>   dispatcher = new zmq::dispatcher_t( 2 );
>   locator = new zmq::locator_t("10.195.6.77");
>   io_thread = zmq::io_thread_t::create( dispatcher );
>   api = zmq::api_thread_t::create( dispatcher, locator );
>   exchangeID = api->create_exchange( "E_TEST",  zmq::scope_global,
> "eth2:5555", io_thread,  1,  &io_thread, zmq::style_load_balancing);
> 
>   delete dispatcher;
>   delete locator;
>   delete io_thread;
> 
>   dispatcher = new zmq::dispatcher_t( 2 );
>   locator = new zmq::locator_t("10.195.6.77");
>   io_thread = zmq::io_thread_t::create( dispatcher );
>   api = zmq::api_thread_t::create( dispatcher, locator );
>   exchangeID = api->create_exchange( "E_TEST",  zmq::scope_global,
> "eth2:5555", io_thread,  1,  &io_thread, zmq::style_load_balancing);
> 
> }

Ok, reproduced and scheduled for fixing.

Still, the scenario is pretty uncommon. Would you mind explaining what 
are you trying to achieve?

In general, 0MQ is intended for following scenarios:

1.) Client-server

http://www.zeromq.org/code:examples-chat

2.) Distributed applications

http://www.zeromq.org/tutorials:butterfly
(the whitepaper is not yet finished but readable)

3.) One-to-many data distribution

http://www.zeromq.org/code:examples-camera

None of them requires the functionality you want. My guess would be that 
your use case has to do with periodical download of data via modem.

The use case is known as "file transfer" and looks something like this:

1. Data are gathered during the day on various locations
2. At a specified point (say every midnight) central computer connects 
to every location via modem and downloads the gathered data. Then it 
closes the connection.
3. Data are processed at the central location.

While this is a perfectly valid use case, you should consider using a 
tool designed specially for such situations (like FTP or any of plethora 
of commercial file transfer applications) rather then trying to use a 
general-purpose messaging system.

Martin



More information about the zeromq-dev mailing list