Hi I'm pretty sure it's some best practice issue here. To summarize:

  • I have NET6 publisher socket using NETMQ that is supposed to collect datas for my machine learning model.

  • The machine Learning model is in a separate console App (because it was not compatible with the data feeder at step 1). This is where I have my subscriber. I notice that I always have to launch the subscriber console App first before running the publisher to receive data. So I can debug/run once and receives perfectly the messages. But if I keep the publisher running and try to debug again or launch the subscriber app then nothing is received. I did thread.Sleep(1000) after publishing but nothing... So my questions are:

  • a

Is it normal that I alwas have to launch the subscriber first ?

  • b

If not what could help reconnect the subscriber properly when the publisher is already sending or bind ? Thanks a lot.

==> I would like to be able to publish/subscribe at anytime properly. I tried the thread.sleep to let the subscriber connect to the tcp but I see that nothing helps when I try to connect while the publisher is already "Bind".

1

There are 1 best solutions below

0
On

Fixed: To summarize the issue. The code was cyclic and was coming back to the publishing part every 'x' timeframe. After the first publishing the Publisher was disposed which caused the next times to raise an Exception.

I just created a new instance each time I come back to the publishing part:

using (publisher = new PublisherSocket()).

That was all.