[zeromq-dev] PUSH/PULL connection reset issue

James Chapman james at linux-101.org
Thu Aug 13 14:28:12 CEST 2015

Resending, this time from the subscribed email address. Apologies if you
receive this twice.

Hi ZeroMQ community.

I'm using ZeroMQ 4.1.2 in C++ and I've created a push pull pair of apps to
demonstrate the issue I'm seeing.

When the Push app sends messages with the Pull app, the push sends but the
pull doesn't receive.
In the process of trying to establish what was blocking the receive, I
noticed that the push machine sends a SYN packet, the pull machine replies
with a SYN ACK, and instead of the push machine sending a SYN ACK ACK, it
sends a RST.

The issue does not occur when running both apps on the same host.

Push machine is Windows 2008 VM on Citrix Xen Server, Pull machine is
Windows 10, although I don't believe the platform to be the issue.

Is this a bug or have I done something very wrong?

push/pull code below.


#include <iostream>
#include <string>
#include <thread>
#include <chrono>

#include "zmq.hpp"

int main()
    for (int i = 0; i < 100; ++i)
        ::zmq::context_t context(1);
        auto pZmqSocket(new ::zmq::socket_t(context, ZMQ_PUSH));

        std::string addressString = "tcp://";

        int linger = 0;

        pZmqSocket->setsockopt(ZMQ_LINGER, &linger, sizeof(linger));

        std::string buffer = "Hello world!";

        auto pZmqMsgOut(new ::zmq::message_t(buffer.length()));
        memcpy(pZmqMsgOut->data(), buffer.c_str(), buffer.length());

        std::cout << "Message sent" << std::endl;


        delete pZmqSocket;


    return 0;

#include <iostream>

#include "zmq.hpp"

int main()
    ::zmq::context_t zmqContext(1);
    auto pPullSocket(new ::zmq::socket_t(zmqContext, ZMQ_PULL));

    ::std::string pullSocketString = "tcp://";

    ::zmq::pollitem_t items[] = {
        { *pPullSocket, 0, ZMQ_POLLIN, 0 }

    while (1)
        auto pZmqMsgIn(new ::zmq::message_t());

        zmq::poll(items, 1, -1);

        if (items[0].revents & ZMQ_POLLIN)
            std::cout << "rEvent" << std::endl;
            auto bReceived = false;
            if (pPullSocket->recv(pZmqMsgIn))
                bReceived = true;

            if (bReceived)
                std::string buffer((char *)pZmqMsgIn->data());
                std::cout << "Received: " << buffer << std::endl;

            delete pZmqMsgIn;

    return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150813/1a9e3eb1/attachment.htm>

More information about the zeromq-dev mailing list