VNC logo

Virtual Network Computing

[getting started]
[keep in touch]
Others' ports and add-ons etc
Project ideas
VNC people
[AT&T Laboratories Cambridge]
back to docs

X-based VNC server

Make sure you've read 'Getting Started' for introductory information. 

Xvnc is the Unix VNC server, which is based on a standard X server.  Applications can display themselves on it as if it were a normal X display, but they will actually appear on any connected VNC viewers rather than on a physical screen. 

Xvnc.gif (3567 bytes)

So Xvnc is really two servers in one. To the applications it is an X server, and to the remote VNC users it is a VNC server. By convention we have arranged that the VNC server display number will be the same as the X server display number, which means you can use eg. snoopy:2 to refer to display 2 on machine 'snoopy' in both the X world and the VNC world.

Normally you will start Xvnc using the vncserver script, which is designed to simplify the process, and which is written in Perl. You will probably want to edit this to suit your preferences and local conditions. We recommend using vncserver rather than running Xvnc directly, but Xvnc has essentially the same options as a standard X server, with a few extensions. Running Xvnc -h will display a list.

As mentioned in Getting Started , vncserver can be run with no options at all. In this case it will choose the first available display number, start Xvnc as that display, and run a couple of basic applications to get you started. You can also specify the display number, in which case it will use that number if it is available and exit if not, eg:

vncserver :13

Run with the -help argument to see the other options. The important ones are as follows:

-name name
Each desktop has a name which may be displayed by the viewer. It defaults to 'X' but you can change it with this option.
-geometry widthxheight
Specify the size of the desktop to be created. Default is 1024x768.
-depth depth
Specify the pixel depth in bits of the desktop to be created. Default is 8.
-pixelformat format
Specify pixel format for server to use (BGRnnn or RGBnnn)
In general, you can specify standard X server arguments to vncserver, and they will be passed through to Xvnc. Again, Xvnc -help will list its options, including:.
This significantly changes Xvnc's behaviour so that it can be launched from inetd. See the information on the extras page for details.
Always treat new clients as shared (i.e. ignore client's shared flag).
Never treat new clients as shared (i.e. ignore client's shared flag).
Don't disconnect existing clients when a new "non-shared" connection comes in. Instead the new connection is refused. New "shared" connections are still allowed in the normal way.
Only allow connections from the same machine. Useful if you use SSH and want to stop non-SSH connections from any other hosts. See the guide to using VNC with SSH
-cc n
Sets the colour Visual class used by the server. Some X applications don't cope too well with the TrueColor visual normally used by an 8-bit-deep Xvnc.   You can make the server use a PseudoColor visual by specifying -cc 3.
The server normally uses a lookup table for translating pixel values when the viewer requests a different format from the native one used by the server.  This can use up to 256Kbytes per connected viewer, so if you have many viewers you may wish to specify this option which will save memory at the expense of a little bit of speed. Only relevant for 16-bit-deep desktops. 
-deferupdate n
Xvnc now uses a "deferred update" mechanism which enhances performance in many cases. After any change to the framebuffer, Xvnc waits for this number of milliseconds (default 40) before sending an update to any waiting clients. This means that more changes tend to get coalesced together in a single update. Setting it to 0 results in the same behaviour as previous versions of Xvnc.
The script ~/.vnc/xstartup is executed after the server starts.  If you want to change the window manager used in your VNC desktop, for example, this is where you should do it.
The server also writes log files in the ~/.vnc directory.  These can be useful for tracking down configuration problems and startup errors.

Reverse connections

Xvnc can now make reverse connections to a listening viewer (normally connections are made the other way round - the viewer connects to the server). This is done with a helper program called vncconnect. Simply run:

vncconnect host

where host is the host where the listening viewer is running. If it's not listening on the default port of 5500, you can specify host:port instead. Vncconnect is just a simple X program which sets a property on the root window - it is Xvnc which actually makes the connection. Note that the DISPLAY environment variable must be set as appropriate to control Xvnc - if you run it on an ordinary X server then nothing will happen. Also note that any feedback about the success or failure of the connection will appear in the log file for Xvnc rather than on the terminal where you run vncconnect.

back to docsgo back to documentation

For comments, feedback, etc, please see the 'Keeping in touch' page.
Copyright 1999 - AT&T Laboratories Cambridge