RFB protocol


RFB is an open simple protocol for remote access to graphical user interfaces. Because it works at the framebuffer level it is applicable to all windowing systems and applications, including Microsoft Windows, macOS and the X Window System. RFB is the protocol used in Virtual Network Computing and its derivatives.

Description

By default, a viewer/client uses TCP port 5900 to connect to a server, but can also be set to use any other port. Alternatively, a server can connect to a viewer in "listening mode". One advantage of listening mode is that the server site does not have to configure its firewall/NAT to allow access on the specified ports; the burden is on the viewer, which is useful if the server site has no computer expertise, while the viewer user would be expected to be more knowledgeable.
Although RFB started as a relatively simple protocol, it has been enhanced with additional features and more sophisticated compression and security techniques as it has developed. To maintain seamless cross-compatibility between the many different VNC client and server implementations, the clients and servers negotiate a connection using the best RFB version, and the most appropriate compression and security options that they can both support.

History

RFB was originally developed at Olivetti Research Laboratory as a remote display technology to be used by a simple thin client with ATM connectivity called a Videotile. In order to keep the device as simple as possible, RFB was developed and used in preference to any of the existing remote display technologies.
RFB found a second and more enduring use when VNC was developed. VNC was released as open source software and the RFB specification published on the web. Since then RFB has been a free protocol which anybody can use.
When ORL was closed in 2002 some of the key people behind VNC and RFB formed RealVNC, Ltd., in order to continue development of VNC and to maintain the RFB protocol. The current RFB protocol is published on the RealVNC website.

Protocol versions

Published versions of the RFB protocol are as follows:
VersionPublishedDateSpecification
RFB 3.3ORLJanuary 1998
RFB 3.7RealVNC LtdAugust 2003
RFB 3.8 RealVNC LtdJune 2007
IETF RFC RealVNC LtdMarch 2011

Developers are free to add additional encoding and security types but they must book unique identification numbers for these with the maintainers of the protocol so that the numbers do not clash. Clashing type numbers would cause confusion when handshaking a connection and break cross-compatibility between implementations. The list of encoding and security types was maintained by RealVNC Ltd and is separate from the protocol specification so that new types can be added without requiring the specification to be reissued. Since December 2012, the list went to IANA.
A community version of the RFB protocol specification which aims to document all existing extensions is hosted by the TigerVNC project.

Encoding types

Since encodings are part of the negotiation, some of the encodings below are pseudo-encodings used to advertise the ability to handle a certain extension.
NumberEncoding
0x00000000Raw
0x00000001CopyRect
0x00000002RRE
0x00000004CoRRE
0x00000005Hextile
0x00000006Zlib
0x00000007Tight
0x00000008ZlibHex
0x00000009Ultra
0x00000010ZRLE
0x00000011ZYWRLE
0x00000014H.264
0xFFFF0001CacheEnable
0xFFFF0006XOREnable
0xFFFF8000ServerState
0xFFFF8001EnableKeepAlive
0xFFFF8002FTProtocolVersion
0xFFFFFF00-0xFFFFFF09CompressLevel
0xFFFFFF10XCursor
0xFFFFFF11RichCursor
0xFFFFFF18PointerPos
0xFFFFFF20LastRect
0xFFFFFF21NewFBSize
0xFFFFFFE0-0xFFFFFFE9QualityLevel

Of the picture-based encodings, the most efficient ones are the Tight encoding types. Two types of encodings are defined by TightVNC:
H.264 has been researched for encoding RFB data, but the results were described as lackluster by a TurboVNC developer.

Limitations

In terms of transferring clipboard data, "there is currently no way to transfer text outside the Latin-1 character set". A common pseudo-encoding extension solves the problem by using UTF-8 in an extended format.
The VNC protocol is pixel based. Although this leads to great flexibility, it is often less efficient than solutions that have a better understanding of the underlying graphic layout like X11 or desktop such as RDP. Those protocols send graphic primitives or high level commands in a simpler form, whereas RFB just sends the raw pixel data, albeit compressed.
The VNC protocol expresses mouse button state in a single byte, as binary up/down. This limits the number of mouse buttons to eight. Many modern mice enumerate 9 or more buttons, leading to forward/back buttons having no effect over RFB. A "GII" extension solves this problem.