none
[WPSL]Win10 - Can no longer access UDP port 5353 RRS feed

  • Question

  • Hello,

    I have a WP7/8 app that uses UDP multicast on port 5353 to send and receive Bonjour (mDNS/DNS-SD) messages. As of Windows 10 my app can no longer open this port, receiving the following exception: "System.Exception: Only one usage of each socket address (protocol/network address/port) is normally permitted."

    It appears something in the OS is now using that port, preventing my app from working properly.

    Is there any way to work around this issue?

    Please let me know if you need any more information or if I should post this issue somewhere else. Thanks,

    Matt


    Wednesday, May 6, 2015 3:44 PM

Answers

  • The only way to work around this is to figure out what's using that port and shut it down.  If you're able to reproduce this on a totally clean/refreshed phone, then I imagine that MS has started using that port for it's own purpose. It might also be worthwhile to try a telnet to that port on the phone to see if you can figure out what's listening there.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by Jamles Hez Thursday, May 28, 2015 5:26 AM
    • Marked as answer by Jamles Hez Tuesday, June 9, 2015 5:50 AM
    Thursday, May 7, 2015 3:15 PM
    Moderator
  • Hi Matt - we did get confirmation that 5353 is being used for mdns. Since it's something new in Windows 10, and the workaround is in Windows 10, I'm sorry to say that I don't have any other workarounds for you. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by Jamles Hez Thursday, May 28, 2015 5:27 AM
    • Marked as answer by Jamles Hez Tuesday, June 9, 2015 5:50 AM
    Monday, May 18, 2015 4:45 PM
    Moderator

All replies

  • The only way to work around this is to figure out what's using that port and shut it down.  If you're able to reproduce this on a totally clean/refreshed phone, then I imagine that MS has started using that port for it's own purpose. It might also be worthwhile to try a telnet to that port on the phone to see if you can figure out what's listening there.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by Jamles Hez Thursday, May 28, 2015 5:26 AM
    • Marked as answer by Jamles Hez Tuesday, June 9, 2015 5:50 AM
    Thursday, May 7, 2015 3:15 PM
    Moderator
  • Hi Matt,

    Thanks for getting back to me. I've reproduced this both in the WP10 emulator and on a physical device running WP10.

    From looking at some of the new Win10 APIs it does seem like a built-in implementation of DNS-SD is coming, however I haven't been able to get it to work through these APIs (on desktop or phone). I wouldn't be able to access that from a WP8 SL app anyway, though.

    I looked into this a bit further and found that the Win10 implementation of DatagramSocketControl has a new property called MulticastOnly. By setting this to true (i.e., socket.Control.MulticastOnly = true) I can successfully bind to the port, join the multicast group, and receive messages without interfering with the (apparent) new built-in DNS-SD service.

    As far as I know, the only way I could use this new property to fix this issue would be to rewrite my WP8 SL app to target Win10. If you know of any easier workarounds, please let me know :)

    Thanks,

    Matt

    Thursday, May 7, 2015 5:22 PM
  • Hi Matt - we did get confirmation that 5353 is being used for mdns. Since it's something new in Windows 10, and the workaround is in Windows 10, I'm sorry to say that I don't have any other workarounds for you. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by Jamles Hez Thursday, May 28, 2015 5:27 AM
    • Marked as answer by Jamles Hez Tuesday, June 9, 2015 5:50 AM
    Monday, May 18, 2015 4:45 PM
    Moderator
  • Hi Matt - we did get confirmation that 5353 is being used for mdns. Since it's something new in Windows 10, and the workaround is in Windows 10, I'm sorry to say that I don't have any other workarounds for you. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    I am also very interested in this issue too. My apps implement their own mDNS so I'll need to adjust for Windows 10. Does the Windows 10 SDK have documentation about this new implementation? Was it mentioned at \\Build?
    Monday, May 18, 2015 6:49 PM
  • Hi Matt,

    I'm now working with the "final" tools (VS2015 RTM and Win10 SDK build 10240) and unfortunately I'm still having some trouble with this.

    Setting MulticastOnly to true works as expected on the following devices:

    • Desktop PC running Win10 build 10240
    • Raspberry Pi 2 running Win10 IoT Core build 10240
    • Physical Windows Phone (Lumia 920) running Win10 Mobile build 10166 (deployed by lowering the project's minimum required version)

    All of these devices work as expected, and I am able to open and use UDP port 5353 alongside the system-level mDNS service without any issues.

    I am, however, seeing an issue in the new 10240 phone emulator ("Mobile Emulator 10.0.10240.0"). In the emulator, attempting to open port 5353 using the same code (including setting MulticastOnly to true) I am receiving the following exception:

    Exception thrown: 'System.Exception' in mscorlib.ni.dll
    WinRT information: Only one usage of each socket address (protocol/network address/port) is normally permitted.

    It seems like the system-level mDNS service may be taking exclusive control over the multicast port, preventing my MulticastOnly socket from opening. (Or perhaps the OS is ignoring that I set MulticastOnly to true on my socket?)

    Can you provide any further information about this? Hopefully there will be a newer mobile build I can test on my physical device soon, but I'm concerned that this is not working with the newer emulators.

    Thanks,

    Matt


    • Edited by matt_i Sunday, August 9, 2015 7:50 PM
    Sunday, August 9, 2015 7:40 PM
  • I hit the same issue.

    Looks like "Mobile Emulator 10.0.10240.0" doesn't make use of MulticastOnly=true.

    Tuesday, October 6, 2015 7:39 PM