使用 C#.NET 从 Windows 到 Linux 的远程桌面连接
本文关键字:程桌面 桌面 连接 NET Windows Linux 使用 | 更新日期: 2023-09-27 18:32:38
虽然在C#中为RDP开发,但我们基本上使用MSTSCLib;但是连接Linux这个DLL不支持。那么,在 c# 应用程序中,从 Windows 到 Linux 的 rdp 必须使用什么 dll。
命名空间示例RDC{ 公共分部类 表格 1 : 表格 { 公共表单1(( { 初始化组件((; }
private void button1_Click(object sender, EventArgs e)
{
try
{
rdp.Server = txtServer.Text;
rdp.UserName = txtUserName.Text;
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = txtPassword.Text;
rdp.Connect();
}
catch (Exception Ex)
{
MessageBox.Show("Error Connecting", "Error connecting to remote desktop " + txtServer.Text + " Error: " + Ex.Message,MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
// Check if connected before disconnecting
if (rdp.Connected.ToString() == "1")
rdp.Disconnect();
}
catch (Exception Ex)
{
MessageBox.Show("Error Disconnecting", "Error disconnecting from remote desktop " + txtServer.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
基于此程序如何通过远程桌面编写Windows到Linux的内容
看看Putty,你不能从WindowsRDP进入Linux机器,你可以使用一个名为SSH的协议,它没有GUI,一切都是基于文本的。
RDP是Windows的原生版本。如果您希望Linux充当RDP服务器,请查看XRDP http://sourceforge.net/projects/xrdp/
对于Linux,你可以SSH(Putty支持(。另一种选择是启用大多数Linux发行版支持的VNC服务器。