views:

2718

answers:

2

As part of a client support tool, I'm wanting to provide some functionality to be able to request to view/remote control a desktop session. There are a bunch of ways to get a screen capture and then stream it, but I'm wanting to find out in particular, why the RDP (Remote Desktop / Terminal Services vs. VNC experience is so different. I'm using RDP vs. VNC just because they seem to use drastically different methods to stream the screen to the client.

If I had to guess, RDP appears to transmit blocks of bitmap graphics (say 100x100px) in order to build the full picture (which can be quite slow) but seems to transfer normal painted shapes/fills, or font drawing to the client extremely quickly. VNC seems to take giant snapshots of the screen, compare a previous image and stream the changes to the client.

I feel that RDP is a much more high-quality and smooth protocol than anything else out there, so what technique does it use to accomplish this?

EDIT-Just to clarify, I am asking about these graphics techniques specifically as a streaming protocol programming method - not for which existing product/technology to use to solve this business requirement.

+2  A: 

As you found out, they are both pretty different in the way they stream change. The RDP protocol from MS is and extension of a ITU standard (T.128) that can be purchased online.

RDP implements lots of bandwidth-saving techniques that complement each-other and make it very efficient over low bandwidth.

VNC on the other hand has very basic compression techniques: it will send blocks of bitmap that have changed and will use basic types of compression, from RLE to jpeg to transmit those blocks efficiently.
Unfortunately, it's still quite wasteful over low bandwidth.

VNC basically has no knowledge of the underlying graphic primitives used to build the screen. That makes it easy to use on any machine because it just monitors changes to the screen bitmap.
RDP on the other hand hooks deeper into the Windows API and is able to optimize its stream based on the minimum amount of information necessary to generate the same update on the client.

If you want to integrate remote desktop functionalities, you have a couple of choices:

  • for RDP you may use the ActiveX used for web remote functionalities. You may want to have a look at a wrapper to integrate it into your own software.
    If you want to get deeper into this there is source code available for the linux rdesktop client that does connect to Windows machines across RDP.

  • for VNC there are a number of open source implementations.
    FogCreek's Copilot actually uses one and you can get its source as it is built on TightVNC

There are also a number of projects on CodeProject on RDP and VNC.

Renaud Bompuis
A: 

As Renaud said, VNC simply sends over bitmap changes block by block without any knowledge of what the content is. RDP is much smarter.

You can check out exactly what RDP does from these two specs:

Protocol level: http://msdn.microsoft.com/en-us/library/cc240445%28PROT.10%29.aspx

Graphics level: http://msdn.microsoft.com/en-us/library/cc241537%28PROT.10%29.aspx

I think RDP's biggest gains come from:

  • Caching: The client can store a large amount of previously seen blocks and the server can tell the client how to use them. Also these are persistant so when a client connects to a server it's already been to it can advertise what blocks it has on disk. Very useful when windows get moved. Also many parts of windows, like the title bar are the same.

  • Line/Block drawing. As you guessed RDP has operations for line, poly and rect drawing. With drawing windows these come in use quite a lot.

  • Font drawing. RDP has a way to send over gylphs for fonts and tell the client to render them.

  • Cursor rendering. The cursor icons are sent as glyphs. VNC simply uses a dot

Those are the big ones that come to mind. Check out section 2.2.7 Capability Sets of the protocol spec for the complete list of drawing features.

Jon Clegg