我正在使用 MT4 并使用mql4zmq.dll
链接中给出的包装器
https://github.com/AustenConrad/mql4zmq
因为我已遵循所有说明并成功加载DLL
以及lib
预编译的特定位置的文件。但它不能通过bind
或connect
与socketzmq_connect(,)
或zmq_bind(,)
。请有人帮我解决这个问题。我在这里发布我的代码
// Include the libzmq.dll abstraction wrapper.
#include <mql4zmq.mqh>
//+------------------------------------------------------------------+
//| variable definitions |
//+------------------------------------------------------------------+
int speaker,listener,contextt;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
int major[1];int minor[1];int patch[1];
zmq_version(major,minor,patch);
Print("Using zeromq version " + major[0] + "." + minor[0] + "." + patch[0]);
Print(ping("Hello World"));
Print("NOTE: to use the precompiled libraries you will need to have the Microsoft Visual C++ 2010 Redistributable Package installed. To Download: http://www.microsoft.com/download/en/details.aspx?id=5555");
contextt = zmq_init(1);
speaker = zmq_socket(contextt, ZMQ_PUB);
listener = zmq_socket(contextt, ZMQ_SUB);
// Subscribe to the command channel (i.e. "cmd").
// NOTE: to subscribe to multiple channels call zmq_setsockopt multiple times.
zmq_setsockopt(listener, ZMQ_SUBSCRIBE, "");
if (zmq_bind(speaker,"tcp://127.0.0.1:5555") == -1)
{
Print("Error binding the speaker!");
return(-1);
}
里面有问题
if ( zmq_bind( speaker, "tcp://127.0.0.1:5555" ) == -1 )
它返回-1
而不是bind
。
我已经尝试了所有可能的方法来解开这个谜团,但失败了。
如果我记错了请告诉我!!!