VNC logo

Virtual Network Computing

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


A really simple VNC server.

[screenshot of rfbcounter] We thought we'd release the source code of this just to show that a VNC server doesn't have to be big and complicated, and that you can display things other than desktops! 
Rfbcounter creates and updates a simple numeric counter.  It does so by generating raw VNC protocol to produce the digits, and does not have a framebuffer of its own.

The name comes from the fact that the VNC protocol is sometimes referred to as the RFB protocol.  RFB stands for 'Remote Framebuffer'.

The source code for rfbcounter can be found, tarred and gzipped, here. It is a single C file with a couple of headers, and should compile easily on Linux, and with very little effort on Win32 and other flavours of Unix.


    rfbcounter [-clock] display-number width [fg] [bg]
eg. if you run
    rfbcounter 5 300
you can then connect a VNC viewer to display 5 on that machine and you'll get a counter 300 pixels wide. The fg & bg arguments are single byte values specifying foreground and background colours in BGR233. By prefixing with a zero, you can use octal to simplify color selection, for example 0007 0100 is bright red on a dark blue background.  If you specify the -clock option, rfbcounter will display the current time instead of a free-running counter, and update it once a minute.

Note: rfbcounter does not do any pixel translation.  Your viewer *must* cope with 8-bit bgr233 format for this to work.  On Unix, use the -bgr233 option to vncviewer.

This is not an example of good VNC code.  We ignore lots of messages we shouldn't really ignore, for example.  It only uses the RRE encoding, because that's the easiest way to draw rectangles.


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