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
***
***
***
我现在没有时间,但我应该在标准 MQL5库中 制作一套 CSocketRaw、CSocketTLS 和 CSocketHTTP 实现。
如果我有 8 个小时的空闲时间,我会做的。
谢谢,稍候!
我现在没有时间,但我应该在标准 MQL5库中 制作一套 CSocketRaw、CSocketTLS 和 CSocketHTTP 实现。
如果我有 8 个小时的空闲时间,我会做的。
最好从简单但真正有效的东西开始,例如,从wss://echo.websocket.org 获取答案。
干得漂亮@Francis Dube,谢谢!
有可能创建一个 MQL5 服务来充当 WebSocket 服务器吗?你有一些例子吗?
问题与文章无关,但与网络读取函数有关。
我测量了 SocketTlsReadAvailable() 函数的执行时间。
为什么函数执行时间如此之长?
贵方 是否有可能优化读取函数?
嘿,干得不错、
我刚刚测试了您的 EA,它确实连接到了我的 C# websocket 服务器,但在连接并发送信息后,日志选项卡上出现了以下错误
2022.02.08 07:33:36.176 Websocketclient_test (XAUUSD,M15) [MQL error ID: 5270][IsSocket Readable][Line: 238][Function:CSocket::Readable]。
有什么办法可以解决这个问题吗?发送回 Mt4 似乎也不起作用
@Francis Dube 感谢您提供这个库。我做了一个小改动,使它能处理 / 后的 URL,如 /ws/。
不过我发现它并不稳定,并不总是能正常工作,而你的 WinAPI 版本则好用得多。
由于这是一个本地库,你们是否有解决了稳定性问题的改进版本?
谢谢。
有 8 个小时的空闲时间,我会做的。
两年了,还是没有答案。
这个功能不能用作内存映射文件吗?
这样我们就不必重写代码,而可以使用现成的解决方案。
当然这很好,但这个功能应该是这样的:在终端外写入信息。
两年了,还是没有任何回应。
所以说好的 3 年等待......现在已经不长了--还得等一年 ))