Qt-interest Archive, April 2008
QSocketNotifier and named pipes (FIFOs)
Message 1 in thread
Hi,
i try to use a combination of QFile and QSocketNotifier to watch a named pipe.
I want to react to incoming data.
So i create a QFile in Read/Write Mode (otherwise open() blocks if no writers
exist at application start, which is the normal case).
Then i create a QSocketNotifier with the fd i get from QFile::handle() with
type QSocketNotifier::Read. Then i connect the activated() signal of the
QSocketNotifier to my slot.
This works all fine and dandy. As soon as i echo a few bytes into the named
pipe the activated() signal gets emitted and my slot gets to run. Only
problem is that this happens about one million times which is unexpected. The
docs do not hint at this behaviour.
Any hints about why this happens? And what to do about it?
Regards,
Flo
--
[ signature omitted ]
Message 2 in thread
On Wednesday 16 April 2008 15:53:39 Florian Schmidt wrote:
> This works all fine and dandy. As soon as i echo a few bytes into the named
> pipe the activated() signal gets emitted and my slot gets to run. Only
> problem is that this happens about one million times which is unexpected.
you might get repeative events until you "read empty" or flush the pipe. blame
posix.
> The docs do not hint at this behaviour.
becouse it's just an abstraction wrapper.
> Any hints about why this happens? And what to do about it?
i suggest using QLocalSocket or QxtNamedPipe. thats what you want and they
work fine.
--
[ signature omitted ]
Message 3 in thread
On Thursday 17 April 2008, Arvid Ephraim Picciani wrote:
> On Wednesday 16 April 2008 15:53:39 Florian Schmidt wrote:
> > This works all fine and dandy. As soon as i echo a few bytes into the
> > named pipe the activated() signal gets emitted and my slot gets to run.
> > Only problem is that this happens about one million times which is
> > unexpected.
>
> you might get repeative events until you "read empty" or flush the pipe.
> blame posix.
Ok, thanks for the info. Will incorporate this..
> > The docs do not hint at this behaviour.
>
> becouse it's just an abstraction wrapper.
Ok..
>
> > Any hints about why this happens? And what to do about it?
>
> i suggest using QLocalSocket or QxtNamedPipe. thats what you want and they
> work fine.
Ok.
Thanks and Regards,
Flo
--
[ signature omitted ]