+ 1
How VNC works ??
I made a program which will take screenshots and send send these to remote machine continuesly using sockets. Does VNC works in the same way ?? Which programming language will be better choice for making VNC ?? Mine program doesn't have any functions to control mouse and keyboard. Can anyone help me in this ?? I have used PYTHON and C. I guess C# will be better to make VNC.
1 Answer
+ 2
What programming language is best for an application like VNC server/client?
Usually I'd weigh familiarity with programming languages heavily into the language choice for a project but Java would make this so much easier than I can imagine from Python, c, or c#.
Java seems best for this since it has good networking functionality built into its standard API and has a Robot class that can take screenshots, set mouse positions, simulate key strokes...
To learn more about Java's standard Robot class, check its official documentation at:
https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html
PointerInfo could be useful for getting the mouse cursor position:
https://docs.oracle.com/javase/8/docs/api/java/awt/PointerInfo.html#getLocation%28%29
I haven't captured audio but it looks like this could do the trick:
https://www.codejava.net/coding/capture-and-record-sound-into-wav-file-with-java-sound-api
Capturing audio should be the only data you can't capture using the Robot class.
The only drawback with Java seems pretty minor by comparison to the above benefits. It may be a little harder to make a platform-specific installer.
Yes, VNC probably takes frequent screenshots. The mouse and keyboard control is done through OS-specific API's. The screenshots are probably optimized better than sending stand-alone PNG or JPG files every second or two, though. They probably compress with some video codecs that focus the transmitted data on changes to the screen and intelligently adjust pixel resolution, colour depth... to strike a good balance between lag and image quality. VNC also streams audio which is likely compressed with an audio codec.
VNC works in many operating systems. For Windows, it takes advantage of Windows' Remote Desktop Protocol(RDP). For Mac and Linux, it probably has a more custom communication protocol like described above.
RealVNC was made using c++ and Java according to:
https://en.wikipedia.org/wiki/RealVNC
A lot more detail is discussed there.