java 远程桌面,用Java实现自己的远程桌面

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:

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?

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.

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 will be the best solution here, since it is fastest for video streaming (which is what you are effectively doing).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值