用Java实现自己的远程桌面 [英] Implementing my own remote desktop in java

查看:1159
本文介绍了用Java实现自己的远程桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Java中实现自己的远程桌面解决方案。使用套接字和TCP / UDP。
我知道我可以使用VNC或其他任何东西,但这是我想做的学校作业。

I am trying to implement my own remote desktop solution in java. Using sockets and TCP/UDP. I know I could use VNC or anything else, but its an assignmentwork from school that I want to do.

因此,移动鼠标并单击使用机器人类。我对此有两个疑问:

So for moving the mouse and clicking I could use the Robot class. I have two questions about this:


  1. 如何发送视频?我知道Robot类也可以捕获屏幕,因此我应该按顺序发送图像并在连接的另一端按顺序显示吗?这是实现远程桌面的最佳方法吗?

  1. What about sending the video? I know the Robot class can capture the screen too, so should I just send images in a sequence and display in order at the other side of the connection? Is this the best way to implement remote desktop?

我还应该使用TCP还是UDP?
我认为UDP较难实现,因为我必须弄清楚哪个图像位于另一个图像之后。

Also should I use TCP or UDP? I think UDP would be harder to implement since I will have to figure out which image comes after the other.


推荐答案

您尝试执行的操作将起作用,但是速度非常慢。在通过网络发送图像之前,必须先对其进行压缩。压缩之前,应减少颜色数量。另外,仅应发送自上次更新以来已更改的图像的部分

What you are trying to do will work, but incredibly slow. The images must be compressed before you send them over the net. Before compressing, the number of colors should be reduced. Also, only the portions of the image which have changed since the last update should be sent.

传输鼠标坐标 strong>仅当新鼠标的位置距离上一个位置的距离超过x个像素或y秒数结束时,才应该进行更新。否则,您将为鼠标位置花费大量流量,以至于没有足够的图像空间。

When transferring mouse coordinates an update should only occur if the new mouse position is more than x pixels away from the last position away or a number of y seconds is over. Otherwise you spend so much traffic for the mouse position that there is no room for the images.

UDP 将是最好的解决方案,因为视频流传输最快(这是您实际上正在做的事情)。

UDP will be the best solution here, since it is fastest for video streaming (which is what you are effectively doing).

这篇关于用Java实现自己的远程桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆