[Qt-interest] error passing socket descriptors between applications

Thomi Richards thomir at gmail.com
Mon Aug 17 14:47:54 CEST 2009


Hi,


2009/8/17 Thomi Richards <thomir at gmail.com>:
> In my test application, this works perfectly. However, when I try and
> replicate this in a larger application, It fails. The failure is in:
>
> qnativesocketengine_unix.cpp in the following code (line 674):
>
> EBADF means a bad file descriptor. I've checked, and I'm sure I'm
> doing everything in my large application that I'm doing in my test
> app. Can anyone suggest what might be the issue here? The socket
> descriptor value seems OK to me - it's the original descriptor value +
> 1, so the call to dup() is working.
>

I have figured this out - and it's rather obvious - this works only if
the call to dup() is before the call to QProcess::start(). If it's the
other way around then the new child process does not  inherit the open
file descriptors of the parent.

I can't seem to find a way around this, and since it's nothing to do
with Qt, I guess I should go look elsewhere.

Cheers,



More information about the Qt-interest-old mailing list