The question is not related to the article, but is related to the network read function.
I have measured the execution of the SocketTlsReadAvailable() function
double avgDelay = 0.0;
double it = 0.0;
//-----------------------------------------------------------------------------void Recv()
{
ulong start = GetMicrosecondCount();
int qtyByte = SocketTlsReadAvailable(socket, buf, len);
double delay = (GetMicrosecondCount()-start)/1000.0;
avgDelay += delay;
PrintFormat("Bytes received %d Total time: %.3f ms Avg time: %.3f ms", qtyByte, delay, avgDelay/++it);
}
2021.08.2117:34:35.110 Test Bytes received 142 Total time: 2.860 ms Avg time: 11.824 ms
2021.08.2117:34:35.111 Test Bytes received 852 Total time: 1.131 ms Avg time: 11.819 ms
2021.08.2117:34:35.113 Test Bytes received 710 Total time: 1.874 ms Avg time: 11.815 ms
2021.08.2117:34:35.114 Test Bytes received 142 Total time: 0.668 ms Avg time: 11.810 ms
2021.08.2117:34:35.117 Test Bytes received 142 Total time: 2.551 ms Avg time: 11.805 ms
2021.08.2117:34:35.132 Test Bytes received 0 Total time: 15.564 ms Avg time: 11.807 ms
2021.08.2117:34:35.148 Test Bytes received 0 Total time: 15.616 ms Avg time: 11.809 ms
2021.08.2117:34:35.149 Test Bytes received 0 Total time: 1.383 ms Avg time: 11.804 ms
2021.08.2117:34:35.151 Test Bytes received 710 Total time: 1.855 ms Avg time: 11.799 ms
2021.08.2117:34:35.164 Test Bytes received 142 Total time: 12.117 ms Avg time: 11.800 ms
2021.08.2117:34:35.179 Test Bytes received 0 Total time: 15.530 ms Avg time: 11.801 ms
2021.08.2117:34:35.195 Test Bytes received 0 Total time: 15.542 ms Avg time: 11.803 ms
2021.08.2117:34:35.210 Test Bytes received 0 Total time: 15.570 ms Avg time: 11.805 ms
2021.08.2117:34:35.218 Test Bytes received 0 Total time: 7.363 ms Avg time: 11.803 ms
2021.08.2117:34:35.226 Test Bytes received 142 Total time: 8.143 ms Avg time: 11.801 ms
2021.08.2117:34:35.242 Test Bytes received 0 Total time: 15.549 ms Avg time: 11.803 ms
2021.08.2117:34:35.257 Test Bytes received 0 Total time: 15.554 ms Avg time: 11.804 ms
2021.08.2117:34:35.273 Test Bytes received 0 Total time: 15.351 ms Avg time: 11.806 ms
***
***
***
Why such a large function execution time? Is it possible to optimise the reading function from your side?
I don't have time now, but I should make a set of CSocketRaw, CSocketTLS, CSocketHTTP implementations in the standard MQL5 library.
If I have 8 hours of free time, I will do it.
Thanks, waiting!
I don't have time now, but I should make a set of CSocketRaw, CSocketTLS, CSocketHTTP implementations in the standard MQL5 library.
If I have 8 hours of free time, I will do it.
It is desirable to start with something simple, but really working, for example, to get an answer from wss://echo.websocket.org.
Nice work @Francis Dube, Thanks!
Is it possible to create a MQL5 service that acts as the WebSocket server? Do you have some examples?
The question is not related to the article, but is related to the network read function.
I have measured the execution of the SocketTlsReadAvailable() function
Why such a large function execution time?
Is it possible to optimise the reading function from your side?
Hey great work,
I just tested your ea and it did connect to my C# websocket server, however after it connects and sends the message The journal tab spans this error
2022.02.08 07:33:36.176 Websocketclient_test (XAUUSD,M15) [MQL error ID: 5270][Is Socket Readable ][Line: 238][Function: CSocket::Readable]
any idea how I can get this fixed. Also sending back to Mt4 didn't seem to work
@Francis Dube Thank you for this library. There is a small change I had to make for it to work with URLs after /, e.g. /ws/..
However I find that it is not stable and doesn't always work, where as your WinAPI version works lot better.
As this one is a native library, do you have an improved version with the stability issues fixed?
Thank you
There will be 8 hours of free time, I will do.
It's been two years and still no answer.
Can't this function be used as Memory Maping Files?
So that we don't have to rewrite the code and use a ready-made solution.
Of course it is fantastic, but this function should be like this: Write information outside the terminal.
It's been two years and still no response.
So the promised 3 years wait ... It's not long now - a year to wait ))