本文介绍了无法通过无线网络连接在WinRT平板电脑上接收多播UDP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将标题更改为多播UDP(非USB)。

Changed the title to be Multicast UDP (not USB).

我正在尝试实施MDNS库来发现联网设备并遇到问题。  我的图书馆可以通过有线和无线网络在英特尔产品上运行良好,并且它可以通过ARM设备(原始NVidia平板电脑之一)的有线网络连接超过
。  它不会通过ARM平板电脑(NVidia和Surface)检测无线网络上的任何多播流量。

I am trying to implement a MDNS library to discover networked devices and am having a problem.  My library works well from Intel products over both wired and wireless networks and it works from an ARM device (one of the original NVidia tablets) over a wired network connection.  It does not detect any of the multicast traffic over a wireless network from an ARM tablet (both an NVidia and a Surface).

我的代码如下所示:


private async void InitializeSocket()
{
    try
    {
        _socket = new DatagramSocket();
        _socket.MessageReceived += HandleMessageReceived;

        await _socket.BindServiceNameAsync("5353");
        _socket.JoinMulticastGroup(_multicastAddress);
        _multicastGroupJoined = true;
        _multicastJoinTask = null;
    }
    catch (Exception e)
    {
        Debug.WriteLine("MDNSIOChannel.InitializeSocket: Exception: ", e.Message);
        Debug.WriteLine(e.StackTrace);
        RetryJoinMulticast();
    }
}

private void HandleMessageReceived(DatagramSocket aSocket,
                                   DatagramSocketMessageReceivedEventArgs anArgs)
{
    if (_disposed || (null == MessageReceived) || (null == anArgs.RemoteAddress))
    {
        return;
    }

    try
    {
        MessageReceived(this, new DatagramEventArgs(anArgs));
    }
    catch (Exception e)
    {
        Debug.WriteLine("MDNSIOChannel.HandleMessageReceived: Exception: " + e.Message);
        Debug.WriteLine(e.StackTrace);
        throw;
    }
}

推荐答案

使用与上述片段类似的代码,我们做错了什么?

Using similar code to the fragment above, so are we doing something wrong?

Larry:主题应该是多播UDP而不是多播USB!

Larry: subject should be Multicast UDP not Multicast USB!


这篇关于无法通过无线网络连接在WinRT平板电脑上接收多播UDP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:26