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

Build Status Build status Help making this possible Join the chat at https://gitter.im/LibVNC/libvncserver

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
SASL 20
MSLogon 0xfffffffa
Apple ARD 30
TLS 18
VeNCrypt 19

Encodings

Name Number LibVNCServer LibVNCClient
Raw 1
CopyRect 2
RRE 3
CoRRE 4
Hextile 5
Zlib 6
Tight 7
Zlibhex 8
Ultra 9
TRLE 15
ZRLE 16
ZYWRLE 17
TightPNG -260

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:

  • OpenSSL (-DWITH_OPENSSL=ON -DWITH_GCRYPT=OFF)
    • Supports all authentication methods in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.
  • Libgcrypt (-DWITH_OPENSSL=OFF -DWITH_GCRYPT=ON)
    • Supports all authentication methods in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.
  • Included (-DWITH_OPENSSL=OFF -DWITH_GCRYPT=OFF)
    • Supports only VNC authentication in LibVNCClient and LibVNCServer.
    • Supports WebSockets in LibVNCServer.

Transport Layer Security support in LibVNCClient and LibVNCServer can use:

  • OpenSSL (-DWITH_OPENSSL=ON -DWITH_GNUTLS=OFF)
  • GnuTLS (-DWITH_OPENSSL=OFF -DWITH_GNUTLS=ON)

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 https://developer.android.com/ndk/guides/cmake.html as a reference, but basically it boils down to:

mkdir build
cd build
cmake .. -DANDROID_NDK=<path> -DCMAKE_TOOLCHAIN_FILE=<path> -DANDROID_NATIVE_API_LEVEL=<API level you want>
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.

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.

Now, why not BSD? Well, imagine your child being some famous actor. Along comes a manager who exploits your child exclusively, that is: nobody else can profit from the child, it itself included. Got it?

What reason do you have now to use this library commercially?

Several: You don't have to give away your product. Then you have effectively circumvented the GPL, because you have the benefits of other's work and you don't give back anything. Not good.

Better: Use a concept like MySQL. This is free software, however, they make money with it. If you want something implemented, you have the choice: Ask them to do it (and pay a fair price), or do it yourself, normally giving back your enhancements to the free world of computing.

License

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.

Contact

Owner
Cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.
null
Similar Resources

A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++.

This project has moved to https://gitlab.com/eidheim/Simple-WebSocket-Server. Simple-WebSocket-Server A very simple, fast, multithreaded, platform ind

Nov 2, 2022

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Nov 22, 2022

Now get your alerts & updates about home, wherever you are, with an SMS on your mobile! All with a simple NodeMCU project!

Now get your alerts & updates about home, wherever you are, with an SMS on your mobile! All with a simple NodeMCU project!

Oct 20, 2021

A cross-platform HTTP client library with a focus on usability and speed

EasyHttp A cross-platform HTTP client library with a focus on usability and speed. Under its hood, EasyHttp uses POCO C++ Libraries and derives many o

Nov 9, 2022

Tiny cross-platform HTTP / HTTPS client library in C.

naett /nɛt:/ Tiny HTTP client library in C. Wraps native HTTP client functionality on macOS, Windows, Linux, iOS and Android in a single, simple non-b

Nov 19, 2022

Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Nov 13, 2022

A cross-platform network learning demos. Like high-performance http server

Network-Learn A cross-platform network learning demos (toys). And I try not to use 3rd-party libraries. Welcome to try it out and leave your comments.

Sep 6, 2022

Cross-platform, single .h file HTTP server (Windows, Linux, Mac OS X)

EWS - Single .h File C Embeddable Web Server Latest Version: 1.1.4 released September 9, 2021 Supported platforms: Linux, Mac OS X, Windows License: B

Oct 17, 2022

LANDrop is a cross-platform tool that you can use to conveniently transfer photos, videos, and other types of files to other devices on the same local network.

LANDrop is a cross-platform tool that you can use to conveniently transfer photos, videos, and other types of files to other devices on the same local network.

LANDrop is a cross-platform tool that you can use to conveniently transfer photos, videos, and other types of files to other devices on the same local network.

Nov 27, 2022
Comments
  • Segmentation fault when preferred encoding set as ZRLE

    Segmentation fault when preferred encoding set as ZRLE

    Hello, I have faced one issue when I connects for the first time to my vncserver with ZRLE set as preferred encoding at the client end, the vncserver crashes with SIGSEGV.

    Steps: Started VNC server VNCServer started listening on port 5900 Start the vncviewer(TigerVNC) Under options --> Preferred encoding untick the Auto Select option and select ZRLE Save and connect After sometime the vncserver crashes

    Expected Behavior It should not crash.

    Logs/Backtraces registers: x0-x9 : 0000ffff74000ed0 000000002cb22c58 0000000000000100 0000000000000000 0000ffff68000f80 0000000000000740 0000000000000040 0000000000000040 0000000000000000 0000000000001e00, x10-x19 : 00000000000079e4 0000000000000000 0000ffff7f8e01c0 0000000000000040 0000ffff74000fd0 0000ffff740010d0 0000ffff68000fc0 0000000000001d00 000000306c55ea70 0000ffff70000b20, x20-x29 : 0000ffff68004f90 0000ffff68000f80 0000000000000040 0000000000000740 0000000000000040 0000000000000000 0000ffff70008b20 0000000000000780 0000000000000040 0000ffff7cdcedd0 x30 = 0xffff7f8f2ec0, sp = 0xffff7cdcedd0, pc = 0xffff7f8e0200, pstate = 0x20000000, orig_x0 = 0xffff6803b000, syscallno = 0xffffffff fault address: (null) callstack: [0xffff7f8e0200] (unresolved) rfbSendRectEncodingRRE+0xfc0 /usr/lib64/libvncserver.so.1.0.0 [0xffff7f8f2ec0] (unresolved) rfbSendRectEncodingZRLE+0x320 /usr/lib64/libvncserver.so.1.0.0 [0xffff7f8d45a4] (unresolved) rfbSendFramebufferUpdate+0x834 /usr/lib64/libvncserver.so.1.0.0 [0xffff7f8cd49c] (unresolved) rfbDefaultPtrAddEvent+0x1fc /usr/lib64/libvncserver.so.1.0.0 [0x306c576f78] start_thread (pthread_create.c:463) /lib64/libpthread-2.27.so

    (rfbDefaultPtrAddEvent+0x1fc)[0xffff7f8cd49c]
    resolves to 0xc2a0 + 0x1fc = 0xc49c : libvncserver/main.c:498 clientOutput thread calls rfbSendFramebufferUpdate

    (rfbSendFramebufferUpdate+0x834)[0xffff7f8d45a4] resolves to 0x12d70 + 0x834 = 0x135a4 : libvncserver/rfbserver.c:3129 rfbSendFramebufferUpdate() --> rfbSendRectEncodingZRLE

    (rfbSendRectEncodingZRLE+0x320)[0xffff7f8f2ec0] resolves to 0x31b70 + 0x320 = 0x31e90 : libvncserver/zrleencodetemplate.c:112

    --> ZRLE_ENCODE-->GET_IMAGE_INTO_BUF--> (cl->translateFn)(cl->translateLookupTable, &cl->screen->serverFormat,
    &cl->format, fbptr, (char
    )buf,
    cl->scaledScreen->paddedWidthInBytes, tw, th); } (*cl->translateFn) is calling rfbTranslateWithRGBTables32to8

    (rfbSendRectEncodingRRE+0xfc0)[0xffff7f8e0200] resolves to 0x1e240 + 0xfc0 = 1f200 : libvncserver/tabletranstemplate.c:104 rfbTranslateWithRGBTables32to8 --> static void rfbTranslateWithRGBTablesINtoOUT

    I am using vnc_0.9.10 Please help me to find out what went wrong

  • Some fixes

    Some fixes

    • common: remove the quotation marks form version defines
    • libvncclient: fix possible memory leak
    • libvncclient: add support for UltraVNC protocol 3.8
    • libvncserver: fix out of range access
    • libvncclient: add functionality to abort while waiting for connection
  • LibVNCClient cleanup: prefix with

    LibVNCClient cleanup: prefix with "rfbClient"

    ...and make sure it does not deliberately die() or exit() anywhere

    Item taken from https://github.com/LibVNC/libvncserver/blob/99842d5e8bf6577ef431217b791974497a229e21/TODO.md

  • make SDLvncviewer more versatile

    make SDLvncviewer more versatile

    • [ ] test for missing keys (especially "[]{}" with ./examples/mac),
    • [ ] map Apple/Linux/Windows keys onto each other,
    • [ ] handle selection
    • [ ] handle scroll wheel
    • [ ] teach SDLvncviewer about CopyRect...

    Item taken from https://github.com/LibVNC/libvncserver/blob/99842d5e8bf6577ef431217b791974497a229e21/TODO.md

Minimalistic server (written in C) and a python3 client to allow calling C function on a remote host

Minimalistic server (written in C) and a python3 client to allow calling C function on a remote host

Nov 9, 2022
Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC or RDP)
Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC or RDP)

Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC)

Oct 24, 2022
SimpleSockets is a lightweight set of classes that allow developers to implement IP based network programs.

------------------------------------------------------------------------------------------ * History -------------------------------------------------

Nov 15, 2022
About Add any Program in any language you like or add a hello world Program ❣️ if you like give us ⭐

Hello-World About Add any Program in any language you like or add a hello world Program ❣️ if you like give us ⭐ Give this Project a Star ⭐ If you lik

Oct 28, 2022
single header C(99) library to implement client-server network code for games

single header C(99) library to implement client-server network code for games

Nov 10, 2022
Triton Python and C++ client libraries and example, and client examples for go, java and scala.

Triton Client Libraries and Examples To simplify communication with Triton, the Triton project provides several client libraries and examples of how t

Nov 25, 2022
Simple useful interoperability tests for WebRTC libraries. If you are a WebRTC library developer we'd love to include you!
Simple useful interoperability tests for WebRTC libraries. If you are a WebRTC library developer we'd love to include you!

Overview This project aims to be a convenient location for WebRTC library developers to perform interoperability tests. Who can Participate The projec

Sep 8, 2022
A beginner friendly Client-Server program in C. Socket Programming in C
A beginner friendly Client-Server program in C. Socket Programming in C

basic-client-server Program on basic client-server connection. This is intended to whomever it may be useful. If you use this somewhere else, proper r

Oct 21, 2021
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Nov 24, 2022
Online chess platform (client-server) in Python with StockFish API

PyChess Gra w szachy tylko w Pythonie :) Wymagania Python 3.8 Instalacja Wchodzimy i pobieramy najnowsze wydanie aplikacji. https://github.com/Rafixe

Oct 7, 2021