使用vb.net通过Internet连接远程桌面 [英] Remote desktop Connection over the internet with vb.net

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

问题描述

您好b $ b

如何创建通过互联网连接的远程桌面连接应用程序。我可以使用Microsoft终端服务客户端控件在同一网络上的计算机之间建立连接,但我似乎无法连接到不在同一网络上的计算机。我正在使用vb.net,但如果你在C#中有一些代码,我会转换它并不重要。

以下代码只有在计算机位于同一网络时才能正常工作。 />


 如果 rdp.Connected.ToString()=   0 然后 

< span class =code-keyword>尝试

rdp.Server = test-PC
rdp.UserName = test
Dim secured 作为 IMsTscNonScriptable = DirectCast (rdp.GetOcx(),IMsTscNonScriptable)
secured.ClearTextPassword = test

rdp.Connect()

Catch ex As 异常

MessageBox.Show(ex.Message, .Name,MessageBoxButtons.OK,MessageBoxIcon。错误

结束 尝试

结束 如果







您的回复将会很高赞。

解决方案

这需要一些关于网络系统的知识...



有私有IP的和公共IP,如果你有一个家庭网络,你的内部计算机可能都有私有IP(即192.168.xxx.xxx或类似的东西)。大多数ISP只提供一个公共IP,而路由器(电缆调制解调器,DSL调制解调器等)通常会消耗它。某些路由器可以配置为将公共IP数据直接传递到网络中配置的专用IP地址,或者您可以设置NAT(网络地址转换)或端口转发以将特定端口路由到特定计算机。您还需要在计算机上配置防火墙以接受此流量。



由ISP随机更改发布的公共IP,有时您可以使用数天,数周,或几个月或他们可以持续几个小时。您可以使用像DynDNS这样的服务为您的计算机提供地址,例如myhomepc.dyndns.org或类似内容,查看他们提供的服务或在Google上搜索动态DNS服务。



您在代码中使用的名称是NETBIOS名称,该名称恰好与您的计算机名称相同,因为Windows会自动将两者联系起来。该名称在您的专用网络之外不公开。在网络外部显示某些内容的唯一方法是将您的计算机暴露在互联网上并使用DynDNS或从您的ISP购买静态IP并使用普通DNS服务注册域名并将其指向该静态IP。


检查此解决方案



远程桌面连接 [ ^ ]

Hi
How can i create a remote desktop connection app that connects through the internet. I can make a connection between computers that are on the same network using Microsoft terminal service client control but i can't seem to connect to a computer that's not on the same network. I'm using vb.net but should you have some code in C# it doesn't matter i will convert it.
The below code works fine only if the computers are on the same network.

If rdp.Connected.ToString() = "0" Then

Try

    rdp.Server = "test-PC"
    rdp.UserName = "test"
Dim secured As IMsTscNonScriptable = DirectCast(rdp.GetOcx(), IMsTscNonScriptable)
    secured.ClearTextPassword = "test"

    rdp.Connect()

 Catch ex As Exception

 MessageBox.Show(ex.Message, Me.Name, MessageBoxButtons.OK, MessageBoxIcon.Error)

 End Try

 End If




Your response will be highly appreciated.

解决方案

This requires a little knowledge about network systems...

There are private IP's and public IP's, and if you have a home network, your computers that are internal probably all have private IP's (that is, 192.168.xxx.xxx or something similar). Most ISP's only give one public IP and the router (cable modem, DSL modem, etc) usually consumes it. Some routers can be configured to pass public IP data directly to a configured private IP address in the network, or you can set up NAT (Network Address Translation) or port forwarding to route specific ports to specific computers. You will also need to configure the firewall on the computer to accept this traffic.

Public IP's issued by ISP's change randomly, sometimes you can have them for days, weeks, or months or they can last a few hours. You can use a service like DynDNS to have an address for your computer like myhomepc.dyndns.org or something similar, check out the services they offer or search on Google for Dynamic DNS Service.

The name that you are using in your code is a NETBIOS name which happens to be the same as your computer name since Windows associates the two automatically. That name is not publicly available outside your private network. The only way to make something visible outside the network like that is to expose your computer to the internet and use DynDNS or purchase a static IP from your ISP and use a normal DNS service to register a domain name and point it to that static IP.


check this solution

remote desktop connection[^]


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

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