How to check connection to X server

Glynn Clements glynn at gclements.plus.com
Mon Nov 5 12:19:06 PST 2007


Levine, Rob wrote:

> I have an app that connects to an X server and listens for particular
> events.
> 
> Periodically, I need to query the X serve to determine if the app is
> still connected.
> 
> How can I do this?
> 
> Is there an X api call, perhaps, that I could send to the X server that
> will reply with a status if the connection is ok or not?

How do you intend to identify the specific client in which you are
interested?

If the client creates any windows, you can use XQueryTree() to
enumerate the top-level windows. From that, you can probably identify
the client based upon the properties attached to the window. See the
source of xlsclients for hints.

If the client doesn't create any windows, it will still show up in the
list returned by XResQueryClients(), but you'll need to identify it
via its resource base/mask.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list