[Development] [QIODevice]How to correctly treat/understand of the documentation?

Denis Shienkov denis.shienkov at gmail.com
Mon Apr 21 18:35:54 CEST 2014


Thiago,

many thanks for your help.

BR,
Denis

21.04.2014 20:12, Thiago Macieira пишет:
> Em seg 21 abr 2014, às 16:50:50, Denis Shienkov escreveu:
>> Hmmm..
>>
>> Thiago, what do you mean by "writeable"? It is when device was opened in
>> the WriteOnly (ReadWrite) mode, or something else?
> When the underlying device can receive more bytes from the userspace.
>
> Sockets and pipes are buffered in the kernel. When you write to them, they
> don't get sent immediately (for sockets, specifically, there's Nagle's
> algorithm in place). They get buffered and sent later.
>
> That buffer is not unlimited in size. When you write too much, the OS will not
> accept more write() calls. That is, write() will return -EWOULDBLOCK. When
> that happens, you need the QSocketNotifier for Write to tell you when it's
> acceptable to write again.
>
> QAbstractSocket and QProcess always put the data in their own buffer during
> writeData(). Then they enable the QSocketNotifier for Write, if it wasn't
> enabled.
>
> When that notifier fires, in the event loop, the actual writing to the OS
> happens.
>
>> If I correctly understand, then I assume that the device always is
>> "writeable": i.e. opened in WriteOnly (ReadWrite) and the internal buffer
>> of writing is not empty.
> You assume wrong. Therefore, the rest of the email does not make sense.
>




More information about the Development mailing list