2

I have been using zeromq for some time and use multipart message extensively. In C++, I use zmq_sendiov/zmq_recviov to send/recv multipart message. The benefit is I can put each message 'frame' in one iovec, and use the call to send/recv in one go.

Recently I decide to give nanomsg a try, I realize nanomsg has nn_sendmsg/nn_sendmsg which also use iovec. The question is: does nanomsg make sure that the structure of the iovec that is received being the same as the one gets sent? e.g., suppose I put

msg[0].iov_base = "Hello";
msg[0].iov_len = 5;
msg[1].iov_base = "World";
msg[1].iov_len = 5;

and send, will the receiving end get the same iovec array, with "Hello" and "World" in each element, or nanomsg is free to reassemble the buffer?

Thanks Ralph

Ralph Zhang
  • 5,015
  • 5
  • 30
  • 40

2 Answers2

1

Currently in the documentation about this says nothing, but I sure that nanomsg make sure that the structure of the iovec that is received being the same as the one gets sent, because exist one unit test (see https://github.com/nanomsg/nanomsg/blob/fb5670c952c53834c5c7c989eace7c6bd54bd4c5/tests/iovec.c), which confirms my assumptions.

oakio
  • 1,868
  • 1
  • 14
  • 21
1

nanomsg-1.0.0 already support iov nn_sendmsg

norikoSD
  • 92
  • 9