StreamSocketListener and localhost

匆匆过客 提交于 2019-12-24 13:05:29

问题


I'm using the following code to set up a StreamSocketListener on my universal 8.1 app:

_listener = new StreamSocketListener();
_listener.Control.QualityOfService = SocketQualityOfService.Normal;
_listener.ConnectionReceived += OnConnectionReceived;
await _listener.BindServiceNameAsync("8776");

This runs without any problems, however when I try & browse to http://localhost:8776 (or directly via ip address or machine name), the request times out.

In netstat I can see the 8776 port is open & listening, I've enabled loopback exemption, disabled my firewall, but I'm still not able to connect. This is true for both the Windows 8.1 and the Windows Phone 8.1 app.

When I try to connect from another machine, it works without problems. Is there any setting/configuration I can use so I'm able to connect from the same machine?


回答1:


Windows RT blocks loopback access between two WinRT applications.

Network communications using an IP loopback address cannot be used for interprocess communication (between two different apps) in a Windows Runtime app since this is restricted by network isolation. Network communication using an IP loopback address is allowed within an app within the same process for communication purposes.

More info and workaround here



来源:https://stackoverflow.com/questions/26329043/streamsocketlistener-and-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!