Great, thanx!

From: Jonathan Hendry [mailto:jonhen...@mac.com]
Sent: Monday, March 01, 2010 3:15 PM
To: Joe Jones
Cc: cocoa-dev@lists.apple.com Developers
Subject: Re: Is there any Cocoa API (or other way) to determine if an 
application is running in a VNC or ARD session?

Checking on my lsof -i suggestion now that I'm at work...

I just set up a screen sharing session from my laptop to another machine.

lsof -i on my laptop produced the following output:

AppleVNCS 19770  jon    5u  IPv6  0x69d9b2c      0t0  TCP *:vnc-server (LISTEN)
AppleVNCS 19770  jon    6u  IPv6  0x69d85a8      0t0  TCP 
dhc016942.med.harvard.edu:vnc-server->blur.med.harvard.edu:49152 (ESTABLISHED)
Screen    19773  jon    4u  IPv4  0x77a6270      0t0  TCP 
dhc016942.med.harvard.edu:64931->blur.med.harvard.edu:vnc-server (ESTABLISHED)

I didn't have to run lsof as root.

After ending the screen sharing session on the remote computer, lsof -i on my 
mac produces this output:

AppleVNCS 19770  jon    5u  IPv6  0x69d9b2c      0t0  TCP *:vnc-server (LISTEN)

The AppleVNCS 'ESTABLISHED' socket is gone, as is the 'Screen' process and its 
socket, leaving just the screen sharing listening socket.

Apparently the screen-sharing processes run as whoever is logged in at the 
console.

If you want to find out if there's an active VNC session in progress, this 
appears to be a reasonable lead on how to do it, although it won't tell you 
who's controlling the computer at a given time or let you distinguish remote 
input from local input.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to