I was having the problem of the vncserver having too many 'alive' connections because vncclients were being killed abruptly and there is no build in methodology for vncserver that kills the vncserver if nobody is connecting to it. I was toying around with TCPKeepAlive and stuffs, but that didn't really work out fine.
One of the ways to do so if you have access to both the VNCServer and VNCClient codes is to use the ping-pong approach. In the sense that the VNCClient will constantly contact the VNCServer to tell him that it exist. If it does not for after a predefined time limit, you can take for granted that there is either a network problem of VNCClient is not listening to the server anymore. Building it is really quite simple:
1.) create a program call "vncinform" on the remote server. Basically it receives a request from a unique identifier (i.e. an ip address). and update the timestamp of a file.
2.) modify the vncviwer to call "vncinform" remotely using ssh. For example SSH
3.) on the end of the vncserver, create a cron job to kill the vncserver session if the timestamp for a particular host is more than a predefined amount of time.
Done!
No comments:
Post a Comment