[zeromq-dev] how to receive a message into a static buffer?

Aamir M intuitionist at gmail.com
Mon May 4 17:38:36 CEST 2009


John,
In my case, my buffer need to be very small due to hardware restrictions. It
has space for something like 4 to 8 messages. As soon as the data arrives in
the buffer, a DMA transfer occurs to copy the buffer into some specialized
hardware for processing. Once the processing is complete, the buffer is
ready for the next batch of messages.

Regards,
Aamir

On Mon, May 4, 2009 at 11:31 AM, Apps, John <john.apps at hp.com> wrote:

> There is a similar issue with the high-level language wrapper (available
> for all languages, at least on OpenVMS):
>
> The output buffer is returned as an address, as we already know. All very
> well for lower-level languages that know how to deal with addresses, but not
> so good for those that do not, e.g., COBOL, FORTRAN.
>
> There are, of course, runtime library routines on the platform(s) which
> would allow one to copy the data from the output buffer address to some
> local variable. My thought was not to use these as they tend to be platform
> specific, thus making the program harder to port.
>
> The alternatives would appear to be:
>
> 1. pass the address and length of a local variable to the wrapper and have
> it copy the data to the local variable
>
> 2. add an additional call in the wrapper to perform the copy
>
> My preference is 1. above as it would only change the behavior of the
> receive call in the wrapper, not of anything else.
>
>
> PS: how long is the buffer available?
>
> Cheers, John
> ---- John Apps | Hewlett-Packard | John.Apps at HP.com | +49 171 869 1813
> ----
>
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:
> zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Sustrik
> Sent: Monday, May 04, 2009 16:56
> To: Aamir M
> Cc: zeromq-dev at lists.zeromq.org
> Subject: Re: [zeromq-dev] how to receive a message into a static buffer?
>
> Aamir M wrote:
> > Hi Martin,
> >
> > Is the concept of a user-provided receive buffer completely out of the
> > question?  What if the user provided 0MQ with a buffer and promised not
> > to touch the buffer until it gets a pointer from 'receive'? Couldn't the
> > copy be eliminated in this way?  I think this would be a very useful
> > feature for high performance streaming.
>
> The problem remains: The data can be retrieved from the network even
> before you supply the buffer. I don't see any way how to get around
> that. Any ideas?
>
> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090504/205d6a9f/attachment.htm>


More information about the zeromq-dev mailing list