[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Deamons with Qt?
From:       Mirko Boehm <mirko.boehm () home ! com>
Date:       2001-02-26 23:40:47
[Download RAW message or body]

Matthias Ettrich wrote:

> On Sunday 25 February 2001 13:23, Mirko Boehm wrote:
> 
>> Richard Moore wrote:
>> 
>>> Mirko Boehm wrote:
>>> 
>>>> Hi guys,
>>>> 
>>>> does anyone know if there are any reference projects using Qt inside of
>>>> deamon programs? I would like to communicate with QSockets and
>>>> QDataStreams between a regular KDE program and a process running on a
>>>> server without GUI.
>>>> 
>>>> Any ideas?
>>> 
>>> Look at kded etc. IIRC basically you use the GUIenabled argument
>>> to QApplication and avoid anything that relies on an event loop
>>> existing eg. I'd say QSocket probably won't work as there is
>>> no event loop to trigger the QSocketNotifiers, but you should
>>> be ok with using QDataStreams and your own select() call.
>> 
>> That is exactly the problem I had, I have already checked out kded and
>> dcopserver.
>> You either need to have a X Server running to have an event loop, or you
>> may have a QApplication, but only that parts of Qt work that do not rely
>> on the event loop.
>> This limits Qt's fitness for deamons, since it would be a great deal to
>> be able to use the sam eIO device classes (for example) your client
>> programs use.
>> 
> 
> 
> A deamon needs an event loop anway. Instead of calling select() manually, you 
> can just as well use QSocketNotifier and QApplication::exec(). 
> 
> Code-wise and performance-wise this makes not difference at all.
> 
> The Qt event loop works fine without an X Server, it will then do timers and 
> socket notification. In other words: I cannot see the limitation you mention 
> at all.

I simply was not aware that Qt's event loop works without an X-Server.
May be I just did not dig into it deep enough...

Thanks,
--Mirko.

-- 
I am wrong.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic