Important: Please read the Qt Code of Conduct -

Way to find pid of a QWSClient app from QWSServer in Qt/Embedded?

  • Anyone know if there's an easy way to determine a QWSClient's containing process in Qt/Embedded from the QWSServer process?

    I can find the QWSClient from QWSServer::instance()->clientWindows() but need to marry it up to a process (well, a commandline actually, but if I know the pid I can find this through the usual procfs methods).

    Also, I don't have access to the sources for the given QWSClient apps so I can't make them report their QApplication process's pid or commandline to the server directly..

  • Well, after looking through the qt 4.8.0 sources and playing with intercepting QWSServer's unix domain socket for client events, I see that QWSClients' QApplication threads announce the QWSClient identity when opening the socket.

    It looks like the (only?) way to do what I need is to extend QWSServer and use the socket connection descriptors to find the connecting process and map it with the reported identity and pass it up to the (also extended, to ensure instancing of the extended QWSServer derrived class instead of the original) host QApplication::GuiServer

    I'm still hoping someone can point me towards a cleaner, more direct method of achieving this, preferably some internal pre-existing mechanism I've just overlooked.. :)

Log in to reply