I will not write all the checks of the open connection here, for brevity. I will say right away that the server receives the data (displays it in the interface) and sends a response (16 bytes). But the Expert Advisor can’t read the answer.
int _socketHandle = SocketCreate();
SocketConnect(_socketHandle, Address, Port, 1000);
// Sending data to the server (works well)
SocketSend(_socketHandle, _symbolData, ArraySize(_symbolData));
// Here, sometimes false, and sometimes true. I don't know why, but I think it's wrong. Must be strictly either true or false.
// How to cook it properly?
// Here, -1 is always returned by timeout, although the server returns a response after a few milliseconds. Error code 5273 ERR_NETSOCKET_IO_ERROR.
int c = SocketRead(_socketHandle, _serverBuffer, 100, 10000);
if (c == -1)
int err = GetLastError();
Print("Failed to read data from the socket. Error " + IntegerToString(err));