Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMQ Response error #8

Open
venzen opened this issue Jan 22, 2023 · 1 comment
Open

ZMQ Response error #8

venzen opened this issue Jan 22, 2023 · 1 comment

Comments

@venzen
Copy link

venzen commented Jan 22, 2023

In MT4 this Script compiles and all the tests pass when running the test script included with mql-zmq. I can connect to the ZMQ server, however when I send a command I get the following error in the "Experts" panel of the Terminal:

2023.01.22 17:25:43.968 Mt4ServerZMQ XAUUSD.i,H1: >>> Error parsing command: RespParseErrorInvalidPrefix

I connect from Python using a textbook REQ socket:

context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:6666")

socket.send(b"ORDERS")

I have tried encoding the command as "utf-16-le" (WIN32 unicode) but this crashes the server. I have also tried the alternate libraries provided in VC2010 folder of mql-zmq. Installed version of ZMQ is 4.3.2. Any ideas?

@venzen
Copy link
Author

venzen commented Jan 25, 2023

Progress report about this issue. I have familiarized myself with the mt4-server code (not yet mql-lib or mql-zmq) and have placed some Print() statements to see where the code is choking on my command.

      ArrayResize(m_commandBuffer,request.size(),100);
      Print(">>>  Receiving a client request. size: ",request.size());
      request.getData(m_commandBuffer);
      Print(">>>  Parsing client request: ", request.getData());

Up to here I can see that MT4serverZMQ is receiving my command via ZMQ.

Here it is in the Terminal:

Screenshot from 2023-01-25 14-27-57

Parsing the ORDERS command yields NULL:

      RespValue *command=m_parser.parse(m_commandBuffer);
      Print(">>>  entering reply processing for command: ",command);
      RespValue *reply;
      if(command==NULL)
        {
         string error=EnumToString(m_parser.getError());
         Print(">>> Error parsing command: ",error);
         reply=new RespError(error);
        }

So, it receives the command but does not like the bytestream? Or is the response being incorrectly parsed? Apparently the response suffix (+, -, $, etc) is missing or incorrect... I must also mention that this behavior is not replicated when I connect via Redis which returns an array of orders as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant