[zeromq-dev] Feature request: "transmit size" on zmq_msg_t packets

Matt Weinstein mattweinstein at gmail.com
Thu Jun 24 02:28:29 CEST 2010


I'm reading variable length records directly from a MYSQL database,  
with a defined "max field length" into a dynamically allocated  
zmq_msg_t buffer, whose size must be the max field length.

However, I need to send just the characters I retrieved from the  
database, not the full buffer, otherwise I must figure out how to send  
the data field size to the distant end, or at least I must:

1) null the unused portion of the buffer; or
2) copy to a smaller zmq_msg_t.

Both of these require fill or copy operations :-(

What I'd like is to be able to set the "transmit size" of the packet  
to a different value, e.g.

	zmq_msg_transmit_size(&msg, transmit_size);

Only transmit_size bytes would be sent to the distant host, and a  
zmq_msg of that size would be received.

This would not change the size of the underlying buffer, and could be  
reset to a different N between 0<=N<=zmq_msg_size(&msg) at any time  
until it was in transit.

Any thoughts as to whether this would be generally worthwhile, and how  
deeply the size is ingrained within the code layers?




More information about the zeromq-dev mailing list