[nanomsg] Surveyor Socket and Current Connection Count

  • From: Andrew Starks <andrew.starks@xxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Mon, 13 Jan 2014 16:03:37 -0600

Hello,

I'm using nanomsg in a media system where messages are being passed to
filters. Filters are in a tree where there are often multiple children and
sometimes multiple parents.

In my current attempt, the children send content to the parents using a
surveyor socket. The workflow is:

1: Surveyor sends to all parents a content segment.
2: All parents receive the survey and process the content.
3: Each parent replies with "okay" when the content has been consumed.
4: After all parents are done, the filter processes the next content
segment.

This works fine as is, provided that I pre-register the connecting parent,
so that the child filter knows when there are no more parents that have yet
to process the content. (BTW: Pub/sub would work, except that I need  "ack"
that the respondent socket provides, because the child needs to know when
the parent is done, due to the fact that these buffers are actually in
specialized hardware and the messages contain pointers to their objects.)

If the surveyor socket knew the number of connected respondents, I could
then close the survey when the last respondent replied. As it is, a timeout
isn't helpful.

My questions are:

1: Is it possible to use the statistics for this?
2: I can see that the number of connections is tracked (obviously it must
be tracked, on some level). Would extending the survey socket to include a
connected_sockets_count property be ill advised?
3: Should I just go with the approach that I'm taking?
4: From what I've provided, can you comment on whether or not it's likely
that I may be doing this wrong or looking at this in the wrong way?


Thank you ahead of time for any insight that you may be able to provide!

-Andrew

Other related posts: