user25101622
user25101622

Reputation: 193

Multiple calls on QTcpSocket::write?

According to here http://doc-snapshot.qt-project.org/4.8/qiodevice.html

Certain subclasses of QIODevice, such as QTcpSocket and QProcess, are asynchronous.

For example, the first write call has been made to send a chunk of data. Now before the first write call finishes, a second write call has also been made to send another chunk of data.

What happens now? Does the second call waits for the first call to completely finish before starting to send the chunks?

Upvotes: 0

Views: 546

Answers (1)

alexisdm
alexisdm

Reputation: 29886

The data is buffered at least by the system TCP stack, so each call to write "just" appends the new chunk to the unwritten data waiting to be sent.

But if you call write from 2 unsynchronized threads, the result is undefined.

Upvotes: 1

Related Questions