Re: *UPDATE* Binary writing to an input pipe and ASCII reading from an output one



Colossus wrote:

The red bytes do not correspond to the written ones:
Bytes letti: 65536      Bytes scritti: 65536
Bytes letti: 65536      Bytes scritti: 2015
Bytes letti: 65536      Bytes scritti: 0
Bytes letti: 65536      Bytes scritti: 0
Bytes letti: 65536      Bytes scritti: 0
Bytes letti: 12288      Bytes scritti: 0

The strangeness is that I do not have any error, the status of operation
is always G_IO_STATUS_NORMAL; any clue ?

in non-blocking I/O, it is not guaranteed that a call handles all of the
supplied bytes. If you request 4000 bytes, you may receive 3000. Same if
you try to write 4000 bytes, the call may process 3000. Your code should
thus track which bytes are already processed, and offer the remaining
bytes to the function another time.

This is the essention on "non-blocking": the function will stop
processing data if the call would ake too much time, and it will tell
you how far it went. So you may then update your GUI, and present the
remaining data again.

regards,
        Olivier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]