VNC: Remote Control
06 Apr 2010 03:11
06 Apr 2010 03:11
06 Apr 2010 03:11
06 Apr 2010 03:11
nav_first.pngFirst: blog:1
My first blog!
Edited: 06 Nov 2011 11:49 by: James Kanjo
Comments: 2
Tags: ads blog css facebook first free myspace program programming wiki wikidot
nav_prev.pngPrevious: blog:60
Big Homo!
Edited: 05 Jul 2011 13:25 by: James Kanjo
Comments: 7
Tags: coming-out homosexuality me
Last: blog:77
Wikidot: CSS Per Category
Edited: 04 Mar 2012 05:54 by: James Kanjo
Comments: 3
Tags: programming wikidot
Next: blog:62
Wikidot: Specific Users Only
Edited: 06 Nov 2011 11:54 by: James Kanjo
Comments: 5
Tags: programming wikidot
iTunes via iPhone
© James Kanjo, 2010
file: james_kanjo_vnc_iteleport.jpg
fullname: blog:61

After recently converting to MobileMe, I decided to explore the special features of my Mac that I've always been avoiding. These are the features which require a MobileMe subscription to work.

One of these features is “Back to My Mac”, which allows you to essentially control your computer remotely. This is a really cool feature that I certainly would love to do!

Because Apple base their products on the “it just works” philosophy, you can expect that “Back to My Mac” works like a charm, every time. And just as you would expect from Apple, you can access your Mac from any computer, Mac or PC… Wait a second…

You're telling me that “Back to My Mac” ONLY WORKS FROM A MAC????

Grrr. Fine. I'll just use it from my Apple iPhone instead.


You can't even use Back to My Mac from an iPhone. But there is an alternative to remote-controlling your computer: VNC

Virtual Network Computing is a special protocol that, simply said, allows you to see another computer's display, and control the mouse/keyboard input devices. Thus enabling your computer to be remotely controlled.

Setting it up was a learning experience. I enabled “Screen Sharing” on my Mac's Sharing Preferences, and made my Wireless router redirect the 5900 port to the 5900 port of my computer in the home network. Port 5900 is specifically designed, though not necessarily required, for remote controlling a desktop.

When a client makes a request for port 5900 on my router, I don't really want to remotely control the desktop of my router1, so the router needs to redirect the client to port 5900 of my computer. How do I do this? I just change the Port Mapping settings of my Router to map port 5900 to my computer's IP address2.

After the connection has been made, you can set up your computer to require a VNC password… this is recommended, otherwise literally anybody could access your computer.

Now here's the joyful part of the whole process. Every time my router disconnects from the internet, it's IP address changes to what my ISP assigns it with. This will happen whenever I turn off my modem or router, whenever the ISP decides to refresh everybody's IP address, and whenever there is a power outage. Once your IP address has changed, you suddenly don't have access to your computer remotely. So how do we find out this vital piece of information???

It's as simple as an email. On my Mac in the, I have set up a special Mail rule that says:

Whenever an email from James arrives, that has the subject Return IP Address, perform this AppleScript and delete the message

All I need to do is send myself an email with the subject “Return IP Address”. Then a special AppleScript will be performed. I have programmed this AppleScript to email an image of your IP address to the email address you specify (it needs to be hardcoded, sorry):

do shell script "cd ~/Desktop; curl -fO ''"

set theSubject to "Returning IP Address"
set theBody to "The current IP Address in use is:"
set theAttachment to (path to desktop as Unicode text) & "iprand.jpg"

tell application "Mail"
    set theMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
    tell theMessage
        make new to recipient at end of to recipients with properties {address:theAddress}
        tell content
            make new attachment with properties {file name:(theAttachment as alias)} at after the last paragraph
        end tell
    end tell
    send theMessage
end tell

do shell script ("rm " & "~/Desktop/iprand.jpg")

So now if your home network's IP address has changed, just send your self that special email, and you should get a reply containing your email address.
There is an automated alternative to this, which requires your computer to be constantly connected to an external server (a much easier solution), but I'd prefer to keep my IP address as my own business than have it registered at some strange server3.

REMEMBER: You're computer at home needs to be turned on, and not in sleep mode so that it can process your email. Having the screensaver turned on is fine.

So now I just use the iTeleport iPhone App to access my computer anytime, globally.

λ James Kanjo


Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
All content on this page is subject to the guidelines outlined here