On Tuesday, 23 May 2023 12:28:43 PDT Yauheni Pervenenka via Interest wrote: > const auto writeToSocket = [&](){ > const auto written = tcpSocket.write(QByteArray(8192, '1')); > qDebug() << "Sending " << written << " bytes"; > };
> QObject::connect(&tcpSocket, &QIODevice::bytesWritten, > &tcpSocket, [&](auto bytes){ > qDebug() << "Bytes written = " << bytes; > writeToSocket(); > }); This could cause unconstrained memory growth, because you're adding 8kB of data every time that any amount of data gets written. The MTU in the localhost interface is greater than 8 kB, so this won't be a problem in this test, but if you tried this over Ethernet, with an MTU of 1500, it's possible that bytesWritten() would get emitted after 1460 bytes get written. So you'd have: - connected ...after a while... - write 8 kB → buffer is 8 kB - bytesWritten(1460) → buffer is 6732 bytes - write 8 kB → buffer is 14924 - bytesWritten(1460) → buffer is 13464 bytes - write 8 kB → buffer is 21656 ... Anyway, as with any networking problem, please isolate *which* side the problem happens on. Your description said "server read nothing". Well, *which* side had the problem: are you sure the client had sent the data? Confirm with tcpdump that the data was being sent. -- Thiago Macieira - thiago.macieira (AT) intel.com Cloud Software Architect - Intel DCAI Cloud Engineering
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest