[zeromq-dev] Maximum message size on Windows

Alan Ward alan.ward at btinternet.com
Wed Aug 21 12:43:15 CEST 2013


Hi,
I have an application that I have been developing on Linux (Ubuntu) for a
few months.
I am now trying to port it to Windows.

After battling with Visual Studio for a while I now have the code executing,
but have immediately hit a problem with the maximum message size.

On Linux I have a maximum message size of 1Mb (1048576). This is fairly
arbitrary so I can reduce it.
On Windows this causes zmq_recv to crash. I have found that the threshold is
around 1027830.

I am using the 32-bit version of zeromq (3.2.3) on Windows and 64-bit
(3.2.2) on Linux.

The following code snippet causes an exception on my system.

#include <zmq.h>
#include <stdio.h>
#include <tchar.h>
#include <string.h>
#include <assert.h>

int _tmain(int argc, _TCHAR* argv[])
{
    int rc;
    char buffer [ 1027830 ];
    void *context;
    void *responder;
    size_t msg_size;

    puts("start");
    context = zmq_ctx_new ();
    responder = zmq_socket (context, ZMQ_REP);
    rc = zmq_bind (responder, "tcp://*:5555");
    if ( rc != 0 ) { printf("zmq_bind error: rc:%d:errno:%d\n", rc, errno);
return 1; }

    msg_size = zmq_recv (responder, buffer, 2048, 0);

    return 0;
}

Is there a defined maximum size? I did search for some information on this a
while ago, but found nothing.

Regards,
Alan




More information about the zeromq-dev mailing list