[zeromq-dev] Very Small Messages/Manual

Martin Sustrik sustrik at 250bpm.com
Sun Aug 1 21:21:54 CEST 2010


Ben,

>  >Think of this:
>  >
>  >     zmq_msg_t msg;
>  >     zmq_msg_init_size (&msg, 5);
>  >     memcpy (zmq_msg_data (&msg), 5, "ABCDE");
>  >     ...
>  >
>  >Here the _compiler_ allocates the storage for the data on the stack. The
>  >size of the structure has to be fixed otherwise compiler won't know how
>  >to adjust the stack pointer.
> 
> I don't dispute with current design it has to be like that ..but the memory
> could be managed by the pipe which would allow variable messages..And for
> this type of message  the pipe would return a pointer where the data would
> need to be written to. 
> 
> zmq_msg_t* msg  = pipe->CreateNextMessage(size);
> memcpy (zmq_msg_data (msg), 5, "ABCDE");

No way you can make that kind of functionality available via BSD socket 
API :(

Martin




More information about the zeromq-dev mailing list