Path: utzoo!attcan!uunet!samsung!sdd.hp.com!elroy.jpl.nasa.gov!forsight!jato!mars!kaleb From: kaleb@mars.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.windows.x Subject: Re: What is the politically correct way... Message-ID: <3837@jato.Jpl.Nasa.Gov> Date: 25 May 90 23:17:01 GMT References: <3833@jato.Jpl.Nasa.Gov> Sender: news@jato.Jpl.Nasa.Gov Reply-To: kaleb@mars.UUCP (Kaleb Keithley) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 28 I know it's bad form to follow up your own article, but... In article <3833@jato.Jpl.Nasa.Gov> I wrote >to detect that the server has closed the connection to a client? > >I have a (psuedo?) client that only sends XEvents to other clients. >When the user ends a session and logs out (under xdm) the server resets >and closes all client connections. Since my client is not reading >the event queue, it does not detect the closure until the next time it >tries to send. I'd like to detect the closure, and do a gracefull exit, >rather than suffer the consequences of Xlib exit()ing for me. What I have found to work is to periodically do a select(), testing the ability to write on display->fd. When select returns an indication that write is not possible, then I assume the server has closed the connection, and exit gracefully. Two questions: 1. Is this approach reasonable/acceptable. 2. What risk, if any, is there in never reading from display->fd, i.e. never doing a XNextEvent(). In the same vein, does the server ever send anything to a client that doesn't create any windows, never registers for events, in short, I just XOpenDisplay (), and then loop forever doing XSendEvent ()? kaleb@thyme.jpl.nasa.gov Jet Propeller Labs Kaleb Keithley