Internet Technologies/VNC

Virtual Network Computing (VNC) is a remote desktop protocol to remote control another computer. VNC is used to transport the desktop environment of a graphical user interface from one computer to a viewer application on another computer on the network. There are clients and servers for many platforms including Linux, Microsoft Windows, Berkeley Software Distribution variants and MacOS X. In fact you would be hard pressed to not find a viewer available for any GUI operating system. The VNC protocol allows for complete platform independence. A VNC viewer on any operating system can connect to a VNC server on any other operating system. It is also possible for multiple clients to connect to a VNC server at the same time. Popular uses of the technology include remote tech support, and accessing your files on your work PC while at home or even on the road. There is even a Java viewer for VNC, so you can connect to a VNC server from your web browser without installing any software. The original VNC code is open source, as are many of the flavors of VNC available today.

How it works


VNC is actually two parts, a client and a server. A server is the machine that is sharing its screen, and the client, or viewer is the program that is doing the watching and perhaps interacting with the server. VNC is actually a VERY simple protocol and is based one one and only one graphic primitive, "Put a rectangle of pixel data at a given x,y position". What this means is VNC takes small rectangles of the screen (actually the framebuffer) and transports them from the server to the client. This in its simplest form would cause lots of bandwidth to be used, and hence various methods have been invented to make this process go faster. There are now many different 'encodings' or methods to determine the most efficient way to transfer these rectangles. The VNC protocol allows the client and server to negotiate which encoding it will use. The simplest and lowest common denominator is the raw encoding method where the pixel data is sent in left-to-right scanline order, and after initial setup, then only transfers the rectangles that have changed.

how to copy and paste


How do I copy-and-paste from applications running on a server (visible inside a local VNC window) to applications running locally (outside the VNC window) and back?

Some people [1] [2] suggest using xcutsel or autocutsel as a work-around:

On the VNC server side (inside the VNC window) run "xcutsel &". Leave it up and running.

  • 1. If you want to copy from VNC to local, select what you want to copy, then click "copy PRIMARY to 0" in xcutsel, then paste in local.
  • 2. If you want to copy from local to VNC, select what you want to copy, then click "copy 0 to PRIMARY" in xcutsel, then paste in VNC window.

Others [3] recommend autocutsel (or is it autcutsel?), pointing at the VNC FAQ.

For more about the subtleties of cutting and pasting in the X Window System, see "X Selections, Cut Buffers, and Kill Rings." by Jamie Zawinski 2002 (especially helpful if you are writing X11 applications).