[nanomsg] Re: Where "Channel ID" are managed in the code ?

  • From: Laurent Alebarde <l.alebarde@xxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Sat, 18 Jan 2014 10:52:52 +0100

Le 18/01/2014 09:35, zerotacg a écrit :
On 18.01.2014 10:16, Laurent Alebarde wrote:
Le 18/01/2014 08:57, zerotacg a écrit :
On 16.01.2014 11:03, Laurent Alebarde wrote:
Reading that (dated Nov 16th 2013): "the REQ socket can have only one
request at flight at any given moment" from here:
http://comments.gmane.org/gmane.comp.lib.nanomsg/417
I need clarifications to be able to go on. Shall I conclude REP suffers
the same limitations ? Then what I want to do would be not feasible
until asynchronous capability is introduced in REP sockets.
But as a nanomsg newbbie, I cannot be sure.
What is the status please ?
with RAW nn sockets which is kind of like ROUTER in 0mq you should have
enough freedom to get what you want
I need to make work workers in parrallel, and I still don't know if I
can do it with REP. It is not an issue with REQ I think, since the
proxy, to be able to be sticky (one client paired with one worker for
the long run to perform statefull stuff), shall be REP on both sides,
like the 0MQ ROUTER/ROUTER architecture. But in my understanding, nor
REQ nor REP, being RAW or not, are asynchronous. If this is confirmed, I
cannot go on.
nn_socket ( AF_SP_RAW, NN_REP ); // [1]
should get you a raw socket where you get the message header with
channel ids and reply id in nn_recv or similar
an example for this kind of usage would be great, I'll try to mash up
something if I have the time
I agree nn_socket ( AF_SP_RAW, NN_REP ) is what I need. I know I have to hack the library code to manipulate the channel IDs to achieve a statefull behaviour. But still, *I don't know if it is asynchronous*. To be more clear, if clients C1 and C2 send a request to the server. The server is composed of a REP/REP proxy and some REP workers, say W1 and W2.

C1        C2 proxy            W1        W2
X----------|--------->|               |         |
|          |          X-------------->|       |
|          X--------->|request from C1 is dropped?
|          |          X---------------|-------->|
|          |          |               | |
|       |     LOST?|<--------------X         |
|       | unable to send back the answer to C1 (backtrack crushed) ?
| |          |               |         |
| |          |               |         |





Concerning REQ, does it mean for example that I cannot send two messages
until the first one receives a reply ?
when you send a new request the old one gets dropped [1]

[1]
https://github.com/nanomsg/nanomsg/blob/master/src/protocols/reqrep/req.c#L486

[1] http://nanomsg.org/v0.2/nn_socket.3.html


Other related posts: