0

I am writing a RFB server which is able to communicate with RFB Client. The main question is as follows: Currently i am able to capture and send the entrire screen to the client in RAW format. The speed is damn slow for this. Also, the client is sending incremental as false. I want to know a) Whats the best approach so for the server to detect that the screen has changed? b) How to send only the changes screen information to the client.

I know that query asks much off information but still my main point is to know the LOGIC to enable the server to be able to send ONLY incremental updates and to DETECT that screen has changed. I am working in C/C++

3 Answers3

0

Here is a simple Logic which you can use to find incremental updates

1.) store last known framebuffer as refrenceBuffer.

2.) Whenever the client requests a incremental framebuffer do step 3.

3.) capture the current framebuffer and compare if its different from refrenceBuffer

4.) if both the framebuffer continue current framebuffer capturing and comparing with refrenceBuffer till any change occurs(preferably do this in a seperate thread, you may add a few milli seconds incase thread is too heavy.)

5.) The logic compare can be simple bit compare and then find the largest rectangle which encompases all these changes ( you can send to client only this on rectangle)

amIT
  • 664
  • 13
  • 27
0

This depends on the system you are working with and how you are grabbing the screen. There are many ways you can accomplish this. Most involve keeping a buffer of what you have sent to the client and comparing it to what is currently on the screen.

The naivest and simplest to code example( I think ) is to simply hold the screen in little buffers. Lets say you have a 1024 x 1024 pixel frame buffer representing the screen. So in addition to holding (1) 1024 x 1024 buffer of the screen, you keep (256) buffers of size 64 x 64.

Every time you update your big buffer, you compare it to your little buffers, if something changed, you copy that section into the little buffer and send it to the client.

8bitwide
  • 2,071
  • 1
  • 17
  • 24
0

How to detect whether the screen has changed is covered in other answers.

A client will usually send a UpdateRequest with incremental = false for the first update, because it wants to draw the whole thing to start with. Once it has received a rectangle that covers the whole screen, it should then switch to asking for just incremental.

Tomuo
  • 141
  • 1
  • 6