Main Site Documentation

Windows 8.1 Multicasting bug


#1

Just in case anyone here is working or testing with multicast communications on Windows 8.1, I discovered a bug that somehow crept into the RTM build, Microsoft have confirmed it as have several other developers. Its a new bug, no previous version or build of Windows has ever contained it.

Attempting to use a DatagramSocket to get the output stream in order to then send a multicast message can fail with a “Host not found” exception from an “await” call.

Nobody knows why yet but Microsoft are looking at it.

I mention it here because its a shocking and serious fault in an area we all take for granted and if you fell victim to it while testing a system with a .Net MF project, its unlikely you’d suspect Windows until you’d spent days fiddling around .

I’m working on UPnP for Surface and Phone and it has prevented me from testing on a physical Surface device.

B


#2

Thanks for sharing


#3

@ Barraty -
Hi i have been working on a UPNP stack for netmf for a while, the stack is working fine except few issues with different devices, hopefully those will be fixed soon, and honestly all my systems are windows 8.1 and i haven’t ran into this issue…

I’m cleaning the code right now and will release the code soon, just waiting on Mountaineer to fix the multicast issue on their firmware…

Testing machines:
Surface pro: works, can see my netmf devices, and device can see the machine.
Surface Rt same as above
Lenovo tablet same as above
Lenovo x1 carbon same as above
Galaxy tab same as above
Lumina 920 wp8 same as above.
IPad ii same as above…

Netmf devices:
Spider works…
Cerbuino works.
Mountaineer works but no multicast…
Cerb40 not yet tested but I’m sure it’ll work.
Cerberus same as above.
Hydra same as above…
I will wire the other devices and start testing soon…


#4

Hello Jay Jay;

I’ve found others who have been impacted by this. Code which has never failed on Win 8.0 now routinely fails on Win 8.1 I even created a tiny Store sample app that repros the failure.

Is your UPnP implementation running on .Net MF devices or on these other platforms?

If you’re using the other platforms to test UPnP on your .Net MF devices then how exactly do you get you Surface RT to “see” them, what is it that you run?

The bug is very specific - it simply prevents the sending of a multicast datagram from a Store app. This operation never failed on a Store app under Win 8.0 but consistently fails under Win 8.1 at least on my Surface tablet (using WiFi).

My implementation of UPnP for Surface relies on DatagramSocket.GetOutputStreamAsync() to send the datagram, there seems to be no alternative or workaround.

SSDP relies on this, and this is the issue.

The bug isn’t fully understood yet, it may only occur on WiFi networks or there may be some other factor.

See:

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/908c6c55-fb1d-48ed-8275-835efcca9294/multicast-issue-when-migrating-from-win8-to-win81?forum=winappswithcsharp#cfb3866c-e9d7-4df0-8923-877633ff4f5e


#5

Here is sample that fails on Surface Pro running Win8.1 using a WiFi network. Its just a simple Store App created from the blank page template - just add a button to the page and use the event handler shown below.

using System;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using Windows.Networking;
using Windows.Networking.Sockets;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace DatagramSocketBug
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

        }

        async private void Button_Click(object sender, RoutedEventArgs e)
        {
            HostName host = new HostName("239.255.255.250");
            DatagramSocket send_socket = new DatagramSocket();
            DatagramSocket recv_socket = new DatagramSocket();
            await send_socket.BindEndpointAsync(null, String.Empty);
            await recv_socket.BindEndpointAsync(null, "1900");
            recv_socket.JoinMulticastGroup(host);
            // This operation fails when the recv_socket has previously done a 'join'
            IOutputStream op = await send_socket.GetOutputStreamAsync(host, "1900");
            // This is an incorrect message but send anything just to force some IO
            Byte[] buffer = Encoding.UTF8.GetBytes("MSEARCH");

            await op.WriteAsync(buffer.AsBuffer());
            await op.FlushAsync();

        }
    }
}

This fails when run as a Store app on a Surface that’s WiFi connected. If you comment out the references above to the recv_socket the exception isn’t raised. It may fail on any Win 8.1 machine that’s WiFi connected - my Surface is a Pro by the way.


#6

Ahhh, you are using the WinRT API, i was using the windows API, so that’s why i didn’t run into the issue…
I will check and let you know of any workarounds…
Cheers,
Jay


#7

Jay Jay

I updated the code (see above) this is a simplified clone of the pattern I’m using and seems to be a solid repro of the bug.