I'm attempting to use libzmq (4.2.2) via czmqz (4.0.2) to establish an IPC communication channel between a Python program and my C++ application.
I'm using the ZMQ publisher/subscriber pattern, where the Python program binds to a port and publishes messages using pyzmq (16.0.2), and my C++ program uses the zsock class from CZMQ to connect as a subscriber.
The problem is, whenever my subscriber attempts to connect, I get back error code 11, Resource temporarily unavailable. Strangely, this system seems to work just fine on my development machine, but not on the target system I'm deploying to.
The problem occurs on the very first line of initializing the socket in the following abridged method:
bool ZmqSocketWrapper::connectSubscriber(string address)
{
m_address = address;
m_pSocket = zsock_new_sub(address.c_str(), "");
int errorCode = zmq_errno();
if (errorCode != 0)
{
printf(zmq_strerror(errorCode));
return false;
}
return true;
}
This is called as follows:
m_subscriberSocket->connectSubscriber("tcp://127.0.0.1:5555");
And I've also tried other variations, with the same result:
m_subscriberSocket->connectSubscriber("tcp://localhost:23232");
m_subscriberSocket->connectSubscriber("ipc:///tmp/test");
When searching online, it appears that most other people have this problem when attempting to send/receive, so it seems odd that I'm having this when just attempting to open the socket.
A few other details:
- My ZMQ publisher is written in Python using pyzmq and is working fine on the same target system, which suggests that the problem is in czmq.
- The machine where I'm seeing the problem is a Raspberry Pi, in case that's relevant, although bear in mind the point above.
- No, nothing else is using that port, and I've confirmed using netstat that the server port is listening.
- Yes, I've tried running my client as root.
Any help much appreciated!