As with POSIX write (), QIODevice :: write () returns the number of bytes written. It can be any number from 0 to the size of the buffer. In addition, in the event of an error, it may return a negative number, which you must check separately. QIODevice :: write () does not block sockets (they are set to non-blocking mode), bytes are simply added to the buffer and written later. To be notified when writing bytes, you can connect to a bytesWritten (qint64) signal. To lock until bytes are actually written, you can use waitForBytesWritten () (usually this is not a good idea in the main / user interface thread).
source share