Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.)

like image 934
Niki Avatar asked Feb 16 '10 10:02

Niki


2 Answers

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.

like image 73
Tom Duckering Avatar answered Sep 28 '22 05:09

Tom Duckering


check the status of port 5900

like image 42
Colin Pickard Avatar answered Sep 28 '22 04:09

Colin Pickard