[zeromq-dev] 0MQ subscription never ends?

Pieter Hintjens ph at imatix.com
Mon Mar 17 22:26:09 CET 2014


Presumably it's a problem on the server, though without knowing what
it does, it's hard to say.


On Mon, Mar 17, 2014 at 10:17 PM,  <tomb18 at videotron.ca> wrote:
> Hi,
> Can someone please help out here....Is the issue my code or is there a
> problem on the server?
> Thanks!
> On 3/16/14, tomb18 at videotron.ca wrote:
> Hi I am using 0MQ to receive a JSON message from a website. I am able to
> connect and retrieve messages with no problem. The problem is that even
> though I think I close down everything correctly where I am done, the next
> time I connect I get all the messages from the last time I connected! In
> this particular case, the messages are real time and there can be a few each
> second. So if I disconnect for a few days, I will receive thousands of
> messages next time I connect. I do not want that. I only want the messages
> to start when I connect. Does anyone know where I am going wrong?
> Here is the code that I am using to connect and subscribe:
>         using (var context = ZmqContext.Create())
>         {
>             using (var socket = context.CreateSocket(SocketType.SUB))
>             {
>                 socket.SubscribeAll();
>                 socket.Connect("tcp://clublog.org:7373");
>                  var spot = socket.Receive(Encoding.UTF8);
> Everything works fine. When I close the application I issue
>     socket.UnsubscribeAll();
>     socket.Close();
>     context.Terminate();
> I guess I must be doing something wrong. But even more
> troublesome...shouldn't the server stop keeping track of the messages I want
> if I disconnect?
> Thanks for any help!
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list