[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: test if x server is running on a given display



Matt Price wrote:
thanks to stefan for that answer! works great.  though for fun, I'd still ike to
know whether there's a way to contact the server directly to see whether it's
REALLY running....

The simplest way to me is to write an X client program that just makes a connection, then disconnects. Something like this in fact:

#include <X11/Xlib.h>
#define DISPLAY ":0.0"

int main(argc, argv) int argc; char **argv; {
 exit(XOpenDisplay(DISPLAY) ? 0 : -1);
}

Then cc -L/usr/X11R6/lib -lX11 xtest.c

Cheers, Dave



Reply to: