Auto-killing the VNC server

Nathan Ehresman nehresma "at" css.tayloru.edu
Thu, 20 Jul 2000 21:42:18 +0000


> Here's an idea: in the ~/.vnc/xstartup script, start the WM without putting
> it in the background.  Then, after that command, put in a command which
> kills the Xvnc session.  When the WM quits, the script will fall through to
> the 'quit' command and clean the server off the machine.  Eg:
> 
> --- ~/.vnc/xstartup ---
> 
> xclock &
> xterm &
> 
> fvwm2
> 
> vncserver -kill $DISPLAY
> 
> --- end of file ---
> 
> This effectively emulates the behaviour of Xfree86 - when the ~/.Xclients
> script completes (after the WM has shut down), the X server shuts down and
> frees the virtual terminal.

open source is a beautiful thing.  add this at the end of the rfbCloseSock
function in vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/sockets.c:
dispatchException |= 2;  /* DE_TERMINATE */

also add at the top:
extern char dispatchException;

this effectively kills and cleans up the server when a client connection
is lost.

happy hacking.

nathan
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------