I have a ZeroMQ Server set up in MQL4
(a c++ like language), and a ZeroMQ Client in Python. A connection made of PUSH/PULL
-sockets works well, but when I try to send requests from Python using a REQ
-socket to a ZeroMQ REP
-socket, it doesn't receive anything. Here is the Python code :
reqSocket.connect( "tcp://locahost:%d" % REQ_PORT )
jsonMsg = json.dumps( requestMessage )
socket.send_string( jsonMsg )
print( "Sent a message" )
response = socket.recv()
print( "received a message" )
Here is the MQL4
code :
repSocket.bind( StringFormat( "%s://%s:%d",
ZEROMQ_PROTOCOL,
HOSTNAME,
REP_PORT
)
);
repSocket.recv( request, true );
if( request.size() > 0 ) {
string reply = MessageHandler( request );
Print( reply );
repSocket.send( reply );
}
I have no doubt the sockets are connected right, because I have PUSH/PULL
sockets connected the same way and it works fine.