Skip to content


Switch branches/tags

Latest commit

As of 7124b5f the maximum rect width
and size are equal for every compression level so we can easily save
the LUT entries by using constants instead.

This fixes OOB memory accesses in rfbNumCodedRectsTight() when being
called by rfbSendFramebufferUpdate() before SendRectEncodingTight() is
being called the first time (which limits cl->tightCompressLevel to the
size of tightConf).

Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build Status Build status Help making this possible Join the chat at

LibVNCServer: A library for easy implementation of a VNC server. Copyright (C) 2001-2003 Johannes E. Schindelin

If you already used LibVNCServer, you probably want to read NEWS.

What is it?

VNC is a set of programs using the RFB (Remote Frame Buffer) protocol. They are designed to "export" a frame buffer via net: you set up a server and can connect to it via VNC viewers. If the server supports WebSockets (which LibVNCServer does), you can also connect using an in-browser VNC viewer like noVNC.

It is already in wide use for administration, but it is not that easy to program a server yourself.

This has been changed by LibVNCServer.

Projects using it

The homepage has a tentative list of all the projects using either LibVNCServer or LibVNCClient or both.

RFB Protocol Support Status

Security Types

Name Number LibVNCServer LibVNCClient
None 1
VNC Authentication 2
MSLogon 0xfffffffa
Apple ARD 30
TLS 18
VeNCrypt 19
UltraVNC MSLogonII 113


Name Number LibVNCServer LibVNCClient
Raw 1
CopyRect 2
Hextile 5
Zlib 6
Tight 7
Zlibhex 8
Ultra 9
TightPNG -260


Name LibVNCServer LibVNCClient
Encrypted RFB via VeNCrypt
Encrypted RFB via AnonTLS
Encrypted Websockets

How to build

LibVNCServer uses CMake, which you can download here or, better yet, install using your platform's package manager (apt, yum, brew, macports, chocolatey, etc.).

You can then build via:

mkdir build
cd build
cmake ..
cmake --build .

Crypto support in LibVNCClient and LibVNCServer can use different backends:

    • Supports all authentication methods in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.
    • Supports all authentication methods in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.
    • Supports only VNC authentication in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.

Transport Layer Security support in LibVNCClient and LibVNCServer can use:


For some more comprehensive examples that include installation of dependencies, see the Unix CI and Windows CI build setups.

Crosscompiling from Unix to Android

See as a reference, but basically it boils down to:

mkdir build
cd build
cmake --build .

Crosscompiling from Linux to Windows

Tested with MinGW-w64 on Debian, which you should install via sudo apt install mingw-w64. You can make use of the provided toolchainfile. It sets CMake to expect (optional) win32 dependencies like libjpeg and friends in the deps directory. Note that you need (probably self-built) development packages for win32, the -dev packages coming with your distribution won't work.

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-mingw32-linux.cmake ..
cmake --build .

How to use

See the LibVNCServer API intro documentation for how to create a server instance, wire up input handlers and handle cursors.

In case you prefer to learn LibVNCServer by example, have a look at the servers in the examples directory.

For LibVNCClient, examples can be found in client_examples.

Incorporating LibVNCServer/LibVNCClient into your build system

The install process installs pkg-config .pc files for LibVNCServer as well as LibVNCClient which you can use in your build system via the usual pkg-config --cflags libvncserver et al.

If using CMake, LibVNCServer versions > 0.9.13 provide CMake configure files so in your project's CMakeLists.txt, you can say:

	# libs and headers location are now accessible via properties, but you only
	# need to add the respective export target to your project's target_link_libraries,
	# cmake will automatically add libs and headers
	# eg: add client (YOUR_PROJECT_TARGET being a placeholder for your real target -
	# it must be defined by add_executable or add_library):
	target_link_libraries(YOUR_PROJECT_TARGET LibVNCServer::vncclient)
	# add server:
	target_link_libraries(YOUR_PROJECT_TARGET LibVNCServer::vncserver)

Using Websockets

You can try out the built-in websockets support by starting the example server from the webclients directory via ../examples/example. It's important to not start from within the examples directory as otherwise the server program won't find its HTTP index file. The server program will tell you a URL to point your web browser to. There, you can click on the noVNC-Button to connect using the noVNC viewer git submodule (installable via git submodule update --init).

Using Secure Websockets

If you don't already have an SSL cert that's trusted by your browser, the most comfortable way to create one is using minica. On Debian-based distros, you can install it via sudo apt install minica, on MacOS via brew install minica.

Go to the webclients directory and create host and CA certs via:

cd webclients
minica -org "LibVNC" $(hostname)

Trust the cert in your browser by importing the created cacert.crt, e.g. for Firefox go to Options->Privacy & Security->View Certificates->Authorities and import the created cacert.crt, tick the checkbox to use it for trusting websites. For other browsers, the process is similar.

Then, you can finally start the example server, giving it the created host key and cert:

../examples/example -sslkeyfile $(hostname).key -sslcertfile $(hostname).crt

The server program will tell you a URL to point your web browser to. There, you can click on the noVNC-encrypted-connection-button to connect using the bundled noVNC viewer using an encrypted Websockets connection.

Commercial Use

At the beginning of this project Dscho, the original author, would have liked to make it a BSD license. However, it is based on plenty of GPL'ed code, so it has to be a GPL.

The people at AT&T worked really well to produce something as clean and lean as VNC. The managers decided that for their fame, they would release the program for free. But not only that! They realized that by releasing also the code for free, VNC would become an evolving little child, conquering new worlds, making its parents very proud. As well they can be! To protect this innovation, they decided to make it GPL, not BSD. The principal difference is: You can make closed source programs deriving from BSD, not from GPL. You have to give proper credit with both.

Frequently Asked Questions

Our commercial product wants to make use of LibVNCServer to create our own VNC server and distribute. Will this be considered derivative work in the GPLv2 context?

Yes. Please note that while you would have to stick to the GPL for your program if you link to LibVNCServer/LibVNCClient, you do not have to make your code public in case you use the derivative work internally in your organisation, see

Does modifying LibVNCServer code or not make any difference in determining whether our VNC server will be considered derivative work?

No. By simply linking to LibVNCServer/LibVNCClient, your program becomes derivative work.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.



LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.