[zeromq-dev] Does ZMQ_STREAM sockets buffer the whole request?
Pieter Hintjens
ph at imatix.com
Wed Sep 4 19:48:01 CEST 2013
ZMQ_STREAM does buffer, but only between the I/O thread and the
application. That is, if you're reading from the socket slower than
the network delivers data, it will queue up. However since it's a
stream, potentially infinite, it would be pathological (and difficult)
to buffer the whole request (essentially the whole connection).
Remember that with TCP streams, there are no messages. When parsing
HTTP, you read and accumulate data until you get either an end of
connection, or that famous blank line signalling the end of the
header; you then have to look for a Content-Size header, parse that,
and then you can expect that many bytes of data after the blank line.
-Pieter
On Wed, Sep 4, 2013 at 7:41 PM, Sébastien Pierre
<sebastien.pierre at gmail.com> wrote:
> Hi all,
>
> I'm new to ZMQ and wrote a quick and dirty HTTP server using the recently
> released ZMQ_STREAM socket type. I was wondering (before spending too much
> time on it) if this type of socket buffers the client's request before
> sending it to the server (in the zmq_rcv).
>
> I'm thinking of the particular use case where a web browser is uploading a
> large file (say a 100Mb video). I've read here and there in the ZMQ guide
> that messages have to fit in the whole memory... is this the case with
> ZMQ_STREAM as well? I assume that it's not the case and that we would
> receive a series of messages instead of a 100Mb+ message, but I just wanted
> to hear that from the horse's mouth ;)
>
> Thanks,
>
> -- Sébastien
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
More information about the zeromq-dev
mailing list