[nanomsg] Re: Proper way to wait until all messages are sent before exitting process

  • From: Garrett D'Amore <garrett@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Tue, 15 Mar 2016 15:27:13 -0700

Thanks for the article link.  I was going to write a blog article describing 
this problem in more detail. :)

Sent from my iPhone

On Mar 15, 2016, at 2:11 PM, Jason E. Aten <j.e.aten@xxxxxxxxx> wrote:

The end-to-end arguments suggests that the sending application should wait 
for an ack from the receiving application.
There's no other way to know for sure that it's gotten there.

https://en.wikipedia.org/wiki/End-to-end_principle

On Tue, Mar 15, 2016 at 7:33 AM, Fernando Testa <fernando@xxxxxxxxxx> wrote:
Hello all, 

I'm new to nanomsg, and very pleased to play with the library. 
My app has a parent that receives data from a child. After the child has 
sent some data, it sends a end of transmission (EOT) special message that 
breaks the loop in the parent.
If the child dies straight away, sometimes the EOT never reaches the parent. 
Right now, I've put a sleep some milliseconds before the 
I couldn't find a proper way to block until all messages are sent. 
Sockets already have NN_LINGER timeout to -1, but that does not appear to 
fix if the child just exit.
int timeout = -1; //infinite
int rc = nn_setsockopt(socket_, NN_SOL_SOCKET,  NN_LINGER, &timeout, 
sizeof(timeout));
Any suggestions? 
FT

Other related posts: