Problem reading data from socket via SocketRead

 

I'm consistently receiving error 5273 when invoking SocketRead MQL5 API.

I connect to the server from an MT terminal and would like to check periodically if some data have arrived from the server. Here is my code: 

    if(client==INVALID_HANDLE) return false;
    uchar rbuf[512];
    uint rlen=512;
    int res=0;
    res=SocketRead(client,rbuf,rlen,1);
    // SocketIsReadable(client) is equal to 1 at this point
    // res is equal to -1 at this point
    // GetLastError() is equal to 5273 at this point

It works just fine when I connect to the very same server and send/receive data if I replace MT5 built-in socket with winsocket. However using winsocket will not allow me to publish the EA on market which is not an option for me.

Sending data works just fine and server receives the data correctly. I also checked that the server sends packets to the connected MT terminal correctly.

Any ideas?

 
the same issue
 
did you find a solution?