Remote Desktop Application RRS feed

  • Question

  • Hi guys,

    Sorry the old post was not mine, I posted it using another mail address, Sorry for that!

    I'm creating a Remote Desktop Application, like Team Viewer or Shared View.
    Language and Framework used for development is C#.

    As I know there are 3 methods to accomplish such SW, 
    1- Capture, Merge mouse cursor, convert to PNG or JPG and send (Bad)
    2- Capture, Merge mouse cursor, Convert to PNG, XOR algorithm to get difference, Compress (If no change then we compressing black image), Send, at the other end, Decompress XOR again, and render.
    3- Create a graphic driver that redirect info from graphic driver and draw at other side.

    As for number 3, too complicated and need knowledge with drivers in kernel mode, we chose number 2.


    First of all, Screen capture done by API not the .Net method Graphics classes, as the .Net managed code need extra 100 ms than the API one.

    I tried then to drop more info from the captured image, by converting the 24bit image to 8 bit gray scale or 8 bit rainbow; It takes about 200 ms to do that!! And that is bad, Conversion done in .Net code and I can't find a good example to drop image bits, I think the image size decreased.

    Then I convert the BMP image to PNG, to optimize the image, but I’m using Save method to memory stream and that take time, any better method? The XOR algorithm use unsafe code and compare 2 images, It convert the image to byte array, So converting BMP to PNG, will produce a smaller byte array, also dropping image bits from 24 to 8, should minimize image array.

    The result of converting BMP to PNG is byte array, and then I convert back that byte array to image which is PNG & 8 Bit. And pass to XOR

    After that, apply the XOR algorithm to get the difference between the current images and preceded one, which will get only the difference between 2 images, and rest of image will be black.

    Finally Convert the XORED image to byte array again (Take time again), and compress it, Compressing 1200 * 800 of totally black image will result smaller than 1 Kb byte array, That can be sent to other side, Decompress, XOR, Render.

    The approach used above work fine, If it's implemented correctly. But i feel like something missing, The whole process takes 300 ms to done, I saw Team Viewer, i think they use the same method.

    Any advices please

    Tuesday, October 14, 2008 12:00 PM


All replies