Remote Desktop in python? | Sololearn: Learn to code for FREE!

0

Remote Desktop in python?

Taking screenshots forever and sending them to the client is definitely not the answer to Remote Desktop, but it is really the only thing I can think of so, any ideas?

10/25/2020 8:06:03 PM

Youssef Atta'i

4 Answers

New Answer

+5

Ahri Fox So nice to see one of your replies. 😉 Youssef Atta'i Building off of Ahri's suggestion... If I were to consider building my own RDP where performance is prioritized over precise accuracy for low bandwidth connections, I'd probably consider the following: - Bitmap compression library written in something much closer to the metal than Python. - Mouse tracking API to simulate mouse movement on the client to minimize sending images. - Image stitching API to efficiently apply updated deltas in re-imaged areas. - Move image API to simulate the movement of windows with otherwise static pixels to simply relocate a local copy of the image section to another part of the screen. - Dynamic Image API for lowering FPS on sections like video and scrolling animations while increasing refresh on text typing. Oh... and if I was going to such lengths for efficiency, I wouldn't even consider Python. Why are you choosing Python for such a project?

+4

David Carroll I've actually made a remote desktop tool for private use in Python. The difference is, it's controlled entirely via text rather than GUI. The advantage with Python is that you get a lot of tools free. You don't have to write a library to simulate keypresses or screenshots, as it already exists. Such libraries: Pillow [PIL] (image library) pyautogui (controlling mouse and keyboard) pydirectinput (for when pyautogui fails, usually in full screen applications like video games) pyperclip (copypaste clipboard handler) pynput (receiving keyboard input globally) webbrowser (standard library; can open pages on the browser) That said, with it having a GUI, that changes factors considerably against Python. It can be done, though it will be a challenge to get it not to be a CPU hog. Almost makes me want to try it myself, as writing the sceenshot bit via PIL in Cython would likely give a great boost once it escapes Global-Interpreter-Lock. But yes, Python isn't the best choice.

+3

To be more advanced you can make an algorithm which tells how many pixels have changed, and sends the difference. This would lighten the load on the bandwidth end, but might increase CPU load. I would write it in Cython to increase its performance, though that is a bit niche to learn. So instead you might want to write that bit in another more performant language.

+1

David Carroll Thank you, David, after reading your answer I think I have a better idea. I chose python because I've found lots of free modules that looked like they can do the job, Ahri Fox has mentioned some of those modules that made it seem really easy to make my own RDP in pure python.