Description
Hello, I'm trying to write a program which publishes a single message, then quits.
By using strace, I can see a new child process is spawned, which does the sending part.
When I destroy the pub_socket the message is not sent yet. I also do io_context.run() and when it returns the message is not sent yet.
I also tried to let io_context go out of scope, but it doesn't force the message to be sent.
The only thing working for me is adding a sleep_for in the main thread. Then I see the message is sent with 100% success rate.
Is there a better way to "flush" the socket or to perform a "controlled close", so when it returns I can be 100% sure the message has been sent? I'm using an IPC transport, but I guess it's a common issue to all transports.
Thanks!