PDA

View Full Version : void QIODevice::bytesWritten



Magu
24th November 2009, 17:18
Hi all

Somebody can explain me how this signal works?
I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.

Also, I test with QSocketNotifier class with the same file descriptor when a new payload of bytes has been received, to emit the "read" signal, but it didnt work too.

Im trying to develop an application which signal when a new data has come (from a tcpsocket, for example), but i cant, and i don´t know how is possible.

As you can see, i´m a newbie.

Any example will be appreciated.

Regards

(Working with Qt 4.4/Eclipse/Ubuntu 8.04)

wysota
24th November 2009, 19:39
Somebody can explain me how this signal works?
It is emitted when Qt writes data from its internal buffers to the device in question (like a socket).


I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.
"Associate" in what way?

Magu
25th November 2009, 07:53
It is emitted when Qt writes data from its internal buffers to the device in question (like a socket).

Ok, i was thinking in the opposite case, the readyRead() signal, when new data its available for reading.

Now, using readyRead()...



I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.
"Associate" in what way?

Im trying to open a file as QFile, returns a file descriptor with .handle member, declare a QSocketNotifier "associated" with it (passing the fd to the constructor of QSocketNotifier class), and every time a new data is available for read, emits the activated() signal, connecting it with a slot which reads bytes from the device.

But it doesn´t work, so i tried to connect the readyRead() signal (not bytesWritten(), sorry) from the file opened with QFile to do the same as I explain before.

Regards

wysota
25th November 2009, 09:02
Please provide a minimal compilable example reproducing your case. I assure you QSocketNotifier works in general :) But maybe you want QFileSystemWatcher more than QSocketNotifier.