Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

State of the VNC art

A virtualization tool indispensable to those who know it

Cameron Laird (claird@phaseit.net), Vice President, Phaseit, Inc.
Photo of Cameron Laird
Cameron Laird is a long-time developerWorks contributor and former columnist. He often writes about the open source projects that accelerate development of his employer's applications, focused on reliability and security. He first used AIX twenty years ago, when it was still an experimental product. He's been an enthusiastic consumer of and contributor to a variety of memory debugging tools through that time. You can contact him at claird@phaseit.net.

Summary:  Virtual Network Computing (VNC) is widely used, but it is also widely misunderstood. This article carefully outlines both the VNC basics that make it such a value during daily development and administration chores, along with a few of the latest VNC advances.

Date:  27 Mar 2007
Level:  Intermediate
Also available in:   Chinese  Russian

Activity:  14158 views
Comments:  

Are you adept with Virtual Network Computing (VNC)? If not, you'll find that learning even a little about this desktop sharing system pays off big in your daily development or system administration responsibilities.

If you're already familiar with VNC, even better: You're in a position to appreciate the latest innovations based on VNC. Wherever you start, the tour that follows:

  • Introduction
  • VNC as a configuration component
  • VNC as a development platform

should include at least a few scenes that reinforce VNC's indispensability.

Easy introduction to a crucial tool

Indispensable is one of the best words to associate with VNC, incidentally; it belongs in a category with ssh, screen, Expect, and a few other widely applicable tools that multiply productivity, not just boost it. VNC's contribution is to make it easy for a computing process to run here, but display there. You can use VNC to:

  • Look over the shoulder of a colleague working 5000 kilometers away;
  • Connect from home on the weekend to the display of a process that took all week to set up on your desktop at work;
  • Guide an AIX newcomer in a different city through a point-and-click sequence hard to explain on the telephone;

and much more. Perhaps best of all, it should take only a few minutes to start.

For your first experiment, you need to:

  • Install a VNC server, presumably on an AIX host;
  • Install a VNC client or viewer, on any convenient networked desktop;
  • Launch the server and viewer; and
  • Start a test application that runs on one machine, and displays on the other.

Let's look at each step more carefully, to ensure your success.

Server installation and more

VNC is based on a public networking protocol called RFB (see the Resources below for further reading on the technical topics this article raises). VNC software is available both in proprietary and cost-free versions for a remarkable variety of platforms; VNC is useful on everything from mainframes to wristwatch-sized gadgets. For AIX in particular, an easy way to start is with the copy on the Toolbox for Linux® CD which comes with AIX. A current RPM is also available through the IBM AIX Toolbox. Although you can launch VNC as an unprivileged user, and it's possible even to install local copies of it, you'll probably find it easiest for your first installation simply to become root.

Let's be clear on what the first experiment will give. The "Toolbox" installation provides both a VNC server and client; the latter is often called a viewer. To start, you'll probably need only the server on your AIX host. On a viewing machine -- maybe not AIX, and maybe not even X11-equipped -- you need to select a viewer. For popular desktops like Windows®, Linux, and MacOS, there are many distinct viewers.

VNC contrasts with X11 in several ways. X11 has always been a recognized and well standardized way to view results of a remote computation, so in some ways X11 and VNC compete. Confusingly, the two also use terminology in superficially opposite ways:

  • X11:
    • Server displays graphics
    • Client computes results to be displayed
  • VNC:
    • Server renders graphics -- typically on same host where computations are made
    • Client or viewer displays graphics

From a networking perspective, these uses of "client" and "server" are consistent. The labels can puzzle the unwary, though.

X11 and VNC are at least as much teammates as they are rivals. You'll see below that VNC service under AIX typically relies on X11. The X11-plus-VNC combination has many advantages over X11 alone: For instance, VNC operates better, sometimes much better, than (pure) X11 when working over long or slow connections or both. Also, VNC viewers have no responsibilities for font management, and can be much easier to install than X11 servers. Nowadays, you rarely use X11 without VNC except on the console of a UNIX® host.

With your chosen parts in place, launch vncserver on the AIX host with vncserver :2 or similar, and a password you keep safe. This creates a new X server; give it something to show by also launching on your AIX host xterm -display :2.

Now turn to a desktop where you've installed a VNC viewer. Launch a new viewer pointed at $AIX_IP_ADDRESS:2, enter the password, and you should soon see your AIX console, with a fresh xterm already popped into place.

Variations

You've just achieved an important milestone. Your VNC session will "feel" something like X, in that you're viewing on a different machine than the one doing the serious computation. Notice, though, this difference from X: shut down the viewer. Restart it, and reconnect. You have the desktop back again, with all the programs still running! This demonstrates that, unlike conventional X11, VNC is "resumable."

There are many, many more experiments you'll want to do to customize VNC to your situation. Keep in mind that, as already mentioned, VNC is an open standard which supports an abundance of implementations. The Bull Freeware site, for example, has an alternative server that, among other features, can be effectively run by inetd.

Here are a few more possibilities to consider:

  • With the -geometry argument, you can set up a larger framebuffer. Most servers default to 640x480, a size that made more sense almost a decade ago when VNC was first invented than it does on common hardware now.
  • If your AIX installation is sufficiently up-to-date, you don't even need to install a viewer to use VNC; just point a Java™-enabled browser to http://$AIX_IP_ADDRESS:5802. Do you realize what that means? You can show collaborators your latest application with no installation at all. If they have a Java-enabled Web browser --and who doesn't, in 2007? -- you can give them a URL to your latest AIX-based creation.
  • Unlike X11, VNC allows several different remote viewers to connect simultaneously. Read up on the *shared flags in the documentation for the VNC software you use.
  • Security is an issue. If you expose your VNC service on the Net at large, intruders will probe it. Leave it up long enough, and someone will "brute-force" through your password. The Resources at the end of this article point to the many possibilities for hardening VNC security.
  • Be aware that most VNC components have conventions for offseting display and port number by 5800. Reference to X11 server display :2 is typically provided through port 5802, for example. While this, like so many UNIX practices, is configurable, it eases learning to recognize the starting point: :1-5801, :2-5802, and so on.

Think for yourself how many useful scenarios VNC makes possible. One example: You set up a demonstration on a dedicated machine in a laboratory, connected to special hardware, perhaps with hardware-locked licenses. You start a VNC server, and walk into a lecture hall or meeting room, where you show off your full display on a large-screen projector in a professional setting without having your audience trip over the cables and breadboxes in the back room.

VNC as a configuration component

VNC "plays nicely" with other components. It's not just that VNC supports several different options to make its use more convenient; it's configurable in ways that combine well with other practices you might already have. I work with university labs, for example, where dozens of machines are all simply configured to come up automatically with VNC servers running in standard ways. Among other benefits, that means that anyone in the labs can call for help at any time, and a support specialist can "look over his shoulder", even if the specialist is across the country at the time. This makes for much better manageability and economy than having to keep the labs populated at all times with a full complement of support specialists -- or, worse, leaving the students to fend for themselves.

The best way to think about VNC is to recognize that it's just one component in a movement toward virtualization. Computation, display, networking, management -- by standardizing them, they become "mobile," available anywhere a network reaches, and can be arranged to best serve your engineering or business criteria. Just because a motherboard or a display tube is physically restricted to a particular place is no reason your work should be.

Automation works equally well on the viewer side, of course; I have startup routines on my desktops that automatically connect to sessions on servers that I monitor all around the world. I tend to use few options on the viewer side -- sometimes color depth to reduce bandwidth requirements, or input or sharing configuration. For "chronic" use, I particularly like to turn off pointer and keyboard events, so my viewer is read-only. This prevents me from accidentally overwriting or otherwise affecting a remote machine, although I can still monitor exactly what it's doing.

Another facility AIX specialists should know is x11vnc. x11vnc is a VNC server tightly bound to physical hardware. x11vnc's emphasis on performance means that it's practical to view 3D OpenGL graphics through a VNC connection, and its portability allows it to serve from webcams, TV tuners, and other unusual hardware. x11vnc is compatible with most or all of the GXT*P video adapters in current AIX hardware.

VNC as a development platform

Not all potential VNC-based accessories have already been written. It could well happen that you need a facility that doesn't yet exist -- a viewer on unusual hardware, say, or a record-and-playback facility that makes it easy to archive screen snapshots, or specialized video effects to support a teleconference, or a simple notification widget that requires console approval before allowing a VNC connection.

The wealth of open source VNC implementations means that you can study what others have done to program both the server and client sides of RFB. Moreover, there are a few high-level toolkits, like tclRFB (see Resources), that ease VNC programming.

The 0.5 release of tclRFB includes a 500 line example viewer. With the addition of just a few extra lines, you can have the viewer automatically save an image of its remote connection every ten seconds (see Listing 1 ).
Listing 1. Add a recording facility to the example tclRFB viewer


	  proc save_snapshot_and_repeat {canvas_name destination_file delay} {
	      set suffix [clock seconds]
	      $canvas_name postscript -file $destination_file$suffix.ps
	      after $delay [list \
		   save_snapshot $canvas_name $destination_file $delay]
	  }

	  set display_canvas .vp.fb     
	  set file           my_snapshot
	  set interval       10000            ; # Ten seconds.
	  save_snapshot_and_repeat $display_canvas $file $interval
      

While this example formats the snapshots as PostScript, other freely available libraries make it possible to generate MPEG, animated GIFs, and so on.

Most of what I've written here would have been true five years ago: VNC is also like Expect and screen and other productivity marvels in that almost all its functionality was present near its beginning, and much of what's happened since then has been no more than refinement. News in the VNC world mostly has to do with minor enhancements or corrections.

There are a couple of recent significant developments you should know, though:

  • Synergy is software that lets multiple computers share a single mouse and keyboard. This is a different technology than VNC, but will interest some of the same administrators and developers who otherwise would use VNC.
  • NX is open source terminal server software developed by a for-profit company. Its effect is to accelerate transmission of remote X11 or VNC or a few other supported technologies. If you aren't getting the performance you need for remote viewing, give NX a try.

Summary

The main point in all these explorations is to get to know VNC. You'll eventually find the refinements that work best for you. In the beginning of your VNC experience, concentrate on this: don't let physical distance come between you and a computer display you want to see, or have others see, or perhaps both, at the same time. Once you start using VNC, you won't want to live without it. As this article demonstrates, moreover, it takes little to start.


Resources

Learn

  • "Productivity tips" (developerWorks, September 2006): This article focuses on technologies, such as VNC, that make a difference in the work you do each day.

  • "Expect exceeds expectations" (developerWorks, April 2002): Learn how to automate many tasks commonly thought to be only interactive.

  • Read the following documents on Secure Shell (SSH):
  • GNU Screen: The GNU Screen roughly does for command-line connections what VNC does for visual displays. With screen, you can use a single, even slow, command-line connection to manage several character-oriented windows. You can flip between them, disconnect and reconnect later from another location, and more. Like VNC, ssh, and Expect, screen is a program you'll find indispensable.

  • RFB: RFB is a simple protocol for remote access to graphical user interface. As an openly published protocol, RFB has many implementations, both proprietary and free.

  • IBM AIX Toolbox: This page includes VNC and scores of other useful software applications.

  • Bull Freeware: This site includes an alternative VNC server.

  • This Usenet thread: Different AIX series have different graphical hardware. This discussion illustrates how easy it is to bind VNC service to your host's main console, if that's what you want.

  • "Create a VNC system with tclRFB" (developerWorks, August 2003): This article introduces tclRFB as a toolkit for VNC programming.

  • x11vnc: x11vnc is a VNC server which builds in all sorts of features, including UNIX account and password support, server-side scaling, file-transfer functionality, and OpenGL compatibility.

  • Synergy: Synergy lets multiple computers conveniently share a single mouse and keyboard.

  • NX: NX is a terminal server that achieves remarkable performance in transporting, for example, VNC.

  • "Remote computing with a Linux application server farm" (developerWorks, February 2007): This article reports for developerWorks on VNC's role in saving a university lab tens of thousands of dollars.

  • "SSL secures VNC applications" (developerWorks, January 2007): Read this article and find out why it's very common to "tunnel" VNC through SSH to secure a connection.

  • AIX and UNIX: The AIX and UNIX developerWorks zone provides a wealth of information relating to all aspects of AIX systems administration and expanding your UNIX skills.

  • New to AIX and UNIX?: Visit the New to AIX and UNIX page to learn more about AIX and UNIX.

  • AIX 5L™ Wiki: A collaborative environment for technical information related to AIX.

  • Check out other articles and tutorials written by Cameron Laird:
  • Search the AIX and UNIX library by topic:
  • Safari bookstore: Visit this e-reference library to find specific technical resources.

  • developerWorks technical events and webcasts: Stay current with developerWorks technical events and webcasts.

  • Podcasts: Tune in and catch up with IBM technical experts.

Get products and technologies

  • IBM trial software: Build your next development project with software for download directly from developerWorks.

Discuss

About the author

Photo of Cameron Laird

Cameron Laird is a long-time developerWorks contributor and former columnist. He often writes about the open source projects that accelerate development of his employer's applications, focused on reliability and security. He first used AIX twenty years ago, when it was still an experimental product. He's been an enthusiastic consumer of and contributor to a variety of memory debugging tools through that time. You can contact him at claird@phaseit.net.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX
ArticleID=204513
ArticleTitle=State of the VNC art
publish-date=03272007
author1-email=claird@phaseit.net
author1-email-cc=dwxed@us.ibm.com