On Wed, Jun 23, 2010 at 5:28 PM, Matt Weinstein <[email protected]> wrote: > Folks, > > 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.
Why not just create the zmq_msg_t with the shorter length in the first place? As I understand it, creating a zmq_msg_t from existing data is pretty quick and cheap (does not copy). I don't think it should be a problem to create a new zmq_msg_t for each send or recv you do, so you can always set the size to the actual size of the message, not the max field length. Brian > 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? > > Thanks, > > Best, > > Matt > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo [email protected] [email protected] _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
