【发布时间】:2020-10-19 14:53:35
【问题描述】:
Python 代码:
import zmq
import sys
port ="5555"
print("Connecting to hello world server…")
context = zmq.Context()
socket = context.socket(zmq.REQ) # Socket to talk to server
socket.connect("tcp://localhost:%s"%port)
while(1): # Do requests,
try: # waiting each time for a response
message = socket.recv()
print(message)
except:
pass
MQL4 代码:
#include <Zmq/Zmq.mqh>
Context context("helloworld");
Socket socket(context,ZMQ_REP);
socket.bind("tcp://*:5555");
ZmqMsg request;
ZmqMsg reply("Trade was executed");
socket.send(reply);
Print("Feedback: Trade was executed");
当我想将数据从 MQL4 发送到 Python 编程语言时出现无限循环,因为 Python 无法通过端口接收消息数据
【问题讨论】:
标签: python zeromq mql4 algorithmic-trading metatrader4