<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Trouble with QIODevice&#x2F;QAbstractSocket]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have to manage a TCP communication between two hosts (P2P connection).  But I have some misunderstandings with the API of QIODevice and QAbstractSocket to wait, and be sure that the whole data have been transferred.  My problem comes from the fact that QIODevice::write(const QByteArray&amp;) "returns  the number of bytes actually written". But in the same time, we have the function  QAbstractDevice::waitForBytesWritten()  and QIODevice::bytesToWrite().</p>
<p dir="auto">So, my questions are:</p>
<ul>
<li>
<p dir="auto">When I send a small amount of data  should I call waitForBytesWritten? Or should I only check the return value of write()?</p>
</li>
<li>
<p dir="auto">When I send a large amount of data should I iterate on waitForByteWritten until bytesToWrite() return 0? And them do not take care of the return value of write().</p>
</li>
</ul>
]]></description><link>https://forum.qt.io/topic/154008/trouble-with-qiodevice-qabstractsocket</link><generator>RSS for Node</generator><lastBuildDate>Thu, 19 Nov 2026 05:14:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/154008.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Jan 2024 10:43:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trouble with QIODevice&#x2F;QAbstractSocket on Tue, 23 Jan 2024 07:23:40 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">From the looks of it, I would say that the <a href="https://doc.qt.io/qt-6/qiodevice.html#startTransaction" target="_blank" rel="noopener noreferrer nofollow ugc">transaction</a> is what you are looking for.</p>
]]></description><link>https://forum.qt.io/post/787446</link><guid isPermaLink="true">https://forum.qt.io/post/787446</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 23 Jan 2024 07:23:40 GMT</pubDate></item></channel></rss>