StreamSocketListener无法正常工作:请求的地址在其上下文中无效

时间:2016-06-22 12:45:49

标签: c# sockets uwp

我试图从本地SocketServer读取消息。但是connectasync方法总是失败:

    private async void ConnectToServer()
    {
        try
        {
            _socket = new StreamSocketListener();
            _socket.ConnectionReceived += Socket_ConnectionReceived;

            await _socket.BindEndpointAsync(new HostName("192.168.1.51"), "9090");
        }
        catch (Exception ex)
        {

            throw;
        }
    }

错误类型为System.Runtime.InteropServices.COMException,邮件为The requested address is not valid in its context

我无法弄清楚可能出现的问题,因为我还在PackageManifest中声明了所有必需的功能

<Capabilities>
    <Capability Name="privateNetworkClientServer" />
    <Capability Name="internetClientServer" />
</Capabilities> 

0 个答案:

没有答案