How to check connection to X server

Glynn Clements glynn at gclements.plus.com
Tue Nov 6 01:27:01 PST 2007


Levine, Rob wrote:

> The client is my own app.
> The app connects to multiple servers and listens for specific events.
> My question was what mechanism I could put in my client to know when it
> has lost connection to any of the servers that it is connected to.
> The client knows, of course, if it can't connect initially, but I don't
> know how to detect if a connection is lost. 

If a connection to an X server is closed, you will get an I/O error,
which will normally terminate the process. You can install your own
I/O error handler using XSetIOErrorHandler(). However, if your handler
returns, Xlib will terminate the process, so you need to use setjmp()
and longjmp() out of the handler.

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



More information about the xorg mailing list