General Information
Underlying protocol is Remote Frame Buffer (RFB).
2011 RFB Protocol (IETF): good summary of the state of RFB, based on actual implementation as of 2011.
Lifecycle
Stage one: handshaking, to define protocol version and type of security
ProtocolVersion message: server tells client what is the hiest RFB protocol it supports
ProtocolVersion message: client tells server what version to use
Security: server lists supported security types
Security: client specifies what security type to use
Security: based on type, do further security handshaking
SecurityResult message: server sends info re: success or failure
*NOTE: this stage is the only area of variation between versions 3.3, 3.7, and 3.8
Stage two: initialization, exchange ClientInit and ServerInit messages
ClientInit message: client tells server if it wants a shared or exclusive desktop
ServerInit message: server tells client about size of framebuffer, pixel format, and name of desktop
Stage three: normal protocol interaction
Client-to-server messages: SetPixelFormat, SetEncodings, FramebufferUpdateRequest, KeyEvent, PointerEvent, ClientCutText
*NOTE: SetEncodings is also used to check for support for extended features (pseudo-encodings)
Server-to-client messages: FramebufferUpdate, SetColorMapEntries, Bell, ServerCutText
*NOTE: FramebufferUpdate may contain a pseudo-encoding. which contains arbitrary data rather than pixel information
Open-source Implementations