本文介绍了UWP App连接到设备IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我在通过IP地址连接设备时遇到问题。我正在UWP中重写WinForms应用程序。在WinForms应用程序中,我可以使用本地LAN IP地址和设备的IP地址以及发送/接收数据连接到设备。 UWP中的
相同代码不与设备建立连接,而是提供错误"尝试以其访问权限禁止的方式访问套接字xxx.xxx.xxx.xxx:16385" 。到目前为止我发现的一些事情:


  1. 防火墙没有阻塞端口16385.我已经禁用了防火墙,我仍然收到相同的消息。
  2. 我的路由器没有干扰。我打开了WinForms项目和UWP项目,WinForms项目建立了一个连接,而UWP项目没有。
  3. 我正在通过VPN,但WinForms项目再次运行。

连接到设备就像调用内置方法= Open(字符串localIP,字符串deviceIP)一样简单。 LocalIP是我的计算机的LAN适配器,此设备连接到该适配器(在这种情况下是通过VPN分配给连接的地址),
deviceIP是设备的IP地址。我可以ping设备的地址。


此外,不必连接到位于同一网络的VPN的计算机可以毫无问题地连接到设备。


我还需要为UWP解决方案连接到我的设备吗?




Devon Morgan

解决方案

Hello. I am having an issue connecting to a device via IP address. I am re-writing a WinForms application in UWP. In the WinForms application I can connect to the device using my local LAN IP address and the device's IP address and send/receive data. The same code in UWP does not establish a connection with the device but instead provides the error "An attempt was made to access a socket in a way forbidden by its access permissions xxx.xxx.xxx.xxx:16385". A few things I have found so far:

  1. The firewall is not blocking port 16385. I have disabled the firewall, and I still get the same message.
  2. My router is not interfering. I have both the WinForms project and the UWP project open, and the WinForms project establishes a connection while the UWP project does not.
  3. I am going through a VPN, but again the WinForms project works.

Connecting to the device is as simple as calling a built-in method = Open(string localIP, string deviceIP). LocalIP is my computer's LAN adapter to which this device is connected (in this case the address assigned to the connection through the VPN), and deviceIP is the IP address of the device. I can ping the device's address.

Also, a computer not having to connect to the VPN that resides on the same network can connect to the device with no issues.

Is there something additional I have to do for the UWP solution to connect to my device?


Devon Morgan

解决方案


这篇关于UWP App连接到设备IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 18:04