Q:

Is it possible to find out if a VNC connection is active

My application is running on windows XP, a VNC server is also running on the PC. I'd like to find out if someone is currently connected to the VNC server (e.g. to use simpler icons). I'm using UltraVNC.
Is there a simple (preferably documented) way to to this?
EDIT: Apparently someone voted to close because he/she thought this belonged on superuser, so I think I should clarify the question: I need a programmatic solution, preferably in .NET or C++. (This is problem is trivial for a user: just look at the VNC icon in the tray.)

A:

You can use netstat to see if there is an established connection on the port your VNC server is listening on.
try netstat -an | find "ESTABLISHED" | find ":5900" on Windows at the command prompt.
There'll be a line entry for it if someone is connected.
Note: If you're connecting to another server then this search will find that connection too, so pay attention to the presence of the :5900 in the second column from the left since this is the local machine.

A:

check the status of port 5900

