使用套接字编程的远程桌面 [英] Remote desktop using socket programming

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

问题描述

我想使用c#中的套接字编程来实现远程桌面服务器客户端.
我知道C#中的基本套接字编程,但是任何人都可以帮助我使用C#来控制远程计算机的鼠标和键盘吗?

I want to implement remote desktop server client using socket programming in c#.
i know basic socket programming in c# but anyone can help me to get controls of mouse and keyboard of remote computer using c# ?

推荐答案

目前尚不清楚仅实现客户端部分,或者同时实现服务器和客户端.如果要使用现有服务器部分,则必须使用RDP,请参见:
http://en.wikipedia.org/wiki/Remote_Desktop_Protocol [ http://msdn.microsoft.com/en-us/library/aa383015.aspx [ ^ ],
http://support.microsoft.com/default.aspx?scid=kb;EN- US; q186607 [ ^ ].

这两篇CodeProject文章提供了客户端的实现:
使用C#.NET的远程桌面 [ Palantir-远程桌面管理器 [
It is not clear if you want to implement client part only or both server and client. If you want to use existing server part, you have to use RDP, see:
http://en.wikipedia.org/wiki/Remote_Desktop_Protocol[^],
http://msdn.microsoft.com/en-us/library/aa383015.aspx[^],
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q186607[^].

These two CodeProject articles provide the implementations of the client:
Remote Desktop using C#.NET[^],
Palantir - Remote Desktop Manager[^].

—SA


nareshtest0101写道:
nareshtest0101 wrote:

我想同时实现这两个,但是我不想使用RDP还有其他方法吗?

I want to implement both, but I don''t want to use RDP is there any other way?



当然,您可以创建自己的应用程序级别协议,并在软件中实现它.这不是很容易.

首先,服务器端的适当形式是Windows服务.从此处开始:
http://msdn.microsoft.com/zh-CN /library/d56de412%28v=VS.100%29.aspx [ http://msdn.microsoft.com/zh-我们/library/windows/desktop/ms646310%28v=vs.85%29.aspx [ http://pinvoke.net/default.aspx/user32.sendinput [ http://en.wikipedia.org/wiki/P/Invoke [ http://msdn.microsoft.com/en-us/library/Aa712982 [ ^ ];
另请参见此CodeProject文章:基本P/调用 [我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].

—SA



Of course you can create your own application-level protocol and implement it in your software. This is not very easy.

First, the adequate form of the server side would be a Windows Service. Start here: http://msdn.microsoft.com/en-us/library/d56de412%28v=VS.100%29.aspx[^].

I would suggest you implement everything using interactive application at first, convert it to a Windows Service after you debug most of the functionality of the server side: debugging of interactive application is much easier.

Some problem is the translation if input sent through the network to actual input on the server side. Use P/Invoked Windows API SendInput (and nothing else; you will really need low-level simulation of input, as it was done through actual hardware and device drivers for mouse/keyboard), see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^],
http://pinvoke.net/default.aspx/user32.sendinput[^].

If you need to learn P/Invoke, see:
http://en.wikipedia.org/wiki/P/Invoke[^],
http://msdn.microsoft.com/en-us/library/Aa712982[^];
see also this CodeProject article: Essential P/Invoke[^].

You should create an application-level protocol on top of TCP. You can use different levels of networking: from sockets (better in the form of TcpListener/TcpClient) to classical remoting or WCF (in this case, self-hosted by your service). I overview different levels in my past answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA


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

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