On Wed, Mar 23, 2011 at 8:57 AM, Martin Sustrik <[email protected]> wrote:
> 2. There's at least one use case for receiving into fixed buffer, namely > processing a feed of small messages, such as market data... Yes, this is a good use case. OK, let's see how far we can get sticking to the POSIX recv() API, even as an experiment. I'd suggest implementing MSG_TRUNC for a start (I assume you'll also use MSG_DONTWAIT rather than ZMQ_NOBLOCK). MSG_TRUNC will give you vsnprintf-like semantics, i.e. return the real length of the frame rather than the buffer size, when the frame is larger. Then you can choose whether to hold or discard excess data - I'd suggest that by default, discarding it is safest, but if the caller used MSG_TRUNC, you'd want to hold it, and allow re-reading of the whole frame. And for other use cases, chunking (reading one chunk of a frame at a time) is ideal. All these fit into the POSIX semantics, afaics. -Pieter _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
