none
UDP Multicast listener not working on WP8

    Question

  • I have a standard bit of code that listens for a multicast broadcast on the network.

    This all works great on my WP7.1 devices, but on WP8 (Lumia 920) I never get receive any messages.

    Are there any known issues with this?

    Code snippet:

    c = new UdpAnySourceMulticastClient(System.Net.IPAddress.Parse(host), 54329);
    c.BeginJoinGroup(this.OpenCallback, c);
    
    ...
    
    private void OpenCallback(IAsyncResult result)
    {
        c.EndJoinGroup(result);
       c.MulticastLoopback = false;
        byte[] buffer = new byte[65535];
        c.BeginReceiveFromGroup(buffer, 0, buffer.Length, ReceiveFromGroupCallback, new object[] { buffer, c });
    }
    
    private void ReceiveFromGroupCallback(IAsyncResult result)
    {
       //Never hit on Lumia 920
    }
    

    Of course I could move to the new DatagramSocket stuff (if that works - not sure), but that means either giving up WP7 support, or maintaining two versions of the app, which I would like to avoid.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Tuesday, November 06, 2012 7:08 AM

Answers

  • The issue is resolved with the latest firmware update for the Lumia 920. Some of the other phones didn't have this problem, and as mentioned earlier I didn't see an issue with the emulator either as long as you use the new DataGram APIs (which negates your argument that having access to the SDK earlier would have helped, since it would have worked there - let's not beat that dead horse any longer)

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Thursday, January 17, 2013 6:26 AM

All replies

  • What does your send code look like... Are you using BeginSendTo method or BeginSendToGroup method?

    ... Try using BeginSendToGroup method if you are not already using that method.


    -Eric.

    Wednesday, November 07, 2012 7:06 PM
  • I'm not sending -only receiving (sender is a win8 app and wp7 has no problem receiving - same code on wp8 never receive anything)

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Wednesday, November 07, 2012 9:18 PM
  • Here's a simple sample that demonstrates the issue : http://silverlight.sharpgis.net/UdpBugSample.zip

    It has a solution with two projects:
    1. UdpBugSample : Win 8 app that does a UDP multicast.
    2. UdpBugSample.WP: Win7.1 app that receives UDP multicast.
     
    To run the test, deploy #1 on your windows 8 PC and run it. Install #2 on a Lumia 900 and a Lumia 920 and run this. Make sure all devices are connected to the same WiFi.

    You should start seeing the messages come in on the Lumia 900, whereas the Lumia 920 never receives anything.

    Note this might be an issue with any WP7 vs. WP8 devices (these are just the devices I have at my disposal).


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net


    Friday, November 16, 2012 11:33 PM
  • Not sure how your debugging process was organized, but I just ran your sample, as it is, on both a 900 device and a 820 device. Here comes the interesting part - I also ran Wireshark to capture the throughput, and I noticed that there was a blocking path to port 54329 (that you're using).

    Solution:

    Open Windows Firewall (firewall.cpl in the Run dialog), open Advanced Settings. Create a new Outbound Rule (I usually pair those up with inbound rules too, for testing purposes). Create a rule for a port 54329 and set it to allow connections. The program you showed runs fine with proper firewall configuration.


    Dennis Delimarsky - Windows Phone Development MVP

    Wednesday, November 21, 2012 2:15 AM
  • I have a standard bit of code that listens for a multicast broadcast on the network.

    This all works great on my WP7.1 devices, but on WP8 (Lumia 920) I never get receive any messages.

    Are there any known issues with this?

    Code snippet:

    c = new UdpAnySourceMulticastClient(System.Net.IPAddress.Parse(host), 54329);
    c.BeginJoinGroup(this.OpenCallback, c);
    
    ...
    
    private void OpenCallback(IAsyncResult result)
    {
        c.EndJoinGroup(result);
       c.MulticastLoopback = false;
        byte[] buffer = new byte[65535];
        c.BeginReceiveFromGroup(buffer, 0, buffer.Length, ReceiveFromGroupCallback, new object[] { buffer, c });
    }
    
    private void ReceiveFromGroupCallback(IAsyncResult result)
    {
       //Never hit on Lumia 920
    }

    Of course I could move to the new DatagramSocket stuff (if that works - not sure), but that means either giving up WP7 support, or maintaining two versions of the app, which I would like to avoid.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Got exact the same problem! (WP7-emulator/-device: perfect, WP8-emulator: perfect, WP8-device: no receiving)

    But I got a second problem; After sending 2-3 messages to the multicastGroup I'm getting an extreme delay (5-10 seconds) on sending further messages...

    Do you got any solutions in the meanwhile?!

    Thanks in advance

    Thursday, November 22, 2012 9:37 PM
  • I've tried this with the new DatagramSocket API's as well. This still doesn't work on my Lumia 920, but I do see it working in the Emulator (only DatagramSocket works in the emulator though, but still not on Lumia 920).

    This indicates that there is a problem with the Lumia 920, since I've gotten reports that this works on the 820, and I can also see it works in the emulator.

    The suggestion that this is a firewall issue is not correct (if it was, my Lumia 900 or the emulator wouldn't receive anything).


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Saturday, November 24, 2012 12:43 AM
  • I've tried it with the HTC 8X - same issue :/ 

    Actually the UdpAnySourceMulticastClient seems only to work with my old WP7-devices and emulator (WP7/8).

    Does your device receive anything when you send a message from the emulator (host-machine in the same network)?

    Monday, December 03, 2012 9:15 AM
  • I can get this to work on the Emulator if I use the DatagramSocket (it seems the older API's doesn't work with the emulator network stack).

    However if I deploy to my Lumia 920, this doesn't work.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Thursday, December 06, 2012 3:54 PM
  • UDP MULTICAST IS BROKEN -- VIDEO PROOF HERE --> http://youtu.be/v5a3h2_nnt8

    UDP Multicast using the WP7 API is clearly broken in Windows Phone 8.  It is exactly as Morten described, Listening is completely broken.  I loaded the Multicast sockets sample from MSDN, which is a rock/scissor/paper game, onto 3 phones running on Wifi to demonstrate the problem. 

    I came across this with my own code and debugged with wireshark.  Then I decided to go back to a sample that should work and found it didn't...

    Oh how I wish WP8 devices had been available along with the SDK before launch, I would have immediately caught this.  Now, I am left with the nightmare of phones out there that will NEVER work right.  How in the world does this happen!?  This needs to be fixed ASAP!!! 

    Here is the link to the MSDN sample: http://code.msdn.microsoft.com/wpapps/Multicast-Sockets-Sample-51190c11

    And here is the video proof of how broken this is:  http://youtu.be/v5a3h2_nnt8

    If we don't get an official acknowledgement from Microsoft on this issue, I will start e-mailing people on the Windows Phone team... 

    -Valkyrie-MT

    P.S. Also, UDP Broadcast using the WP7 APIs is broken in WP8 as well. So any app in the store that used it does not work on WP8.  This is a BREAKING CHANGE.  Is this a known issue? 

    http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/0c3888a3-90b1-4c6c-b522-0d46bdb2ea1f 

     

    Wednesday, January 16, 2013 7:14 AM
  • The issue is resolved with the latest firmware update for the Lumia 920. Some of the other phones didn't have this problem, and as mentioned earlier I didn't see an issue with the emulator either as long as you use the new DataGram APIs (which negates your argument that having access to the SDK earlier would have helped, since it would have worked there - let's not beat that dead horse any longer)

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Thursday, January 17, 2013 6:26 AM
  • OK.  I have the answer.  I have an acknowledgement from Microsoft that "this is a known problem and will get fixed with a firmware update".  I am hoping that it's in the 'portico' update that is getting deployed now.  My current HTC 8X firmware and OS versions are shown in the picture below.  This version has the broken UDP Multicast.  Morten, what versions does your working Lumia 920 report? 

     

    -Valkyrie-MT

    • Proposed as answer by Valkyrie-MT3 Friday, January 18, 2013 1:16 AM
    Friday, January 18, 2013 1:15 AM
  • As I mentioned in my previous post, this is fixed in a firmware update (and yes I can confirm it's in the portico update). However note that not all phones are affected (ie. the Lumia 820 does not have this problem).

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Friday, January 18, 2013 1:33 AM
  • Hi all,

    What is the status of this issue?  I am running HTC 8X and I still get the issue, I've just checked and apparently my phone is up to date.  I have some very basic code in a test app running on the device and I don't receive messages.

    Monday, March 18, 2013 12:11 PM
  • Status is that the portico update fixes this for Lumia 920. Since not all phones showed this behavior, it could have been phone specific, so I don't know if the portico update resolves this for the 8X.

    Note: just because your phone doesn't report if there's any updates available, doesn't mean it has portico. Ie one of my Lumia 920 phones still hasn't gotten it.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net


    Monday, March 18, 2013 2:40 PM
  • I can confirm that:

    On Nokia 920 (AT&T, with the latest Apr 2013 update), multicast receive works fine.

    On HTC 8X (Verizon, with the latest Apr 2013 update), multicast receive does not work.

    I am using following sample to test the functionality:

    http://blogs.msdn.com/b/wsdevsol/archive/2013/03/19/datagram-socket-communication-in-windows-phone-8.aspx

    Tuesday, May 14, 2013 10:32 PM
  • Hi, never got this to work on the Lumia 920 (unsure about the fix but my phone said that it got the latest firmware now in july).

    However I stumbled on this solution instead:
    http://www.johnthom.com/category/windows-phone-8/

    It uses the same API as the WinRT (which is good if you want to support WinRT too). I tested it and now multicast works everytime.
    In the past multicast worked sometimes but not everytime, I suspect it have something to do initialization order of the networks or something.

    • Proposed as answer by patsv99 Saturday, July 20, 2013 5:42 AM
    Saturday, July 20, 2013 5:42 AM
  • I have latest fireware update both in Lumia 520 and 920. Still the problem of not receiving the packets is there in Windows phone. Is there any other way to make it work?
    Thursday, February 20, 2014 5:12 AM