-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multicast UDP Packets Stopped Working on iOS MAUI App #21814
Comments
Thank you for moving this to the right place. Often it is hard to know exactly where to put things. |
I just realized that I titled this wrong and gave some wrong information. I am trying to send a BROADCAST packet and not multicast. You can see that in the udpClient.Send because the IP address is 255.255.255.255. |
So I tried creating a very simple test app in .NET 7, and it still fails for me (it prints "Exception: No route to host") This is what it does: try {
using var udpClient = new UdpClient (new IPEndPoint(IPAddress.Any, 12345));
var sendbuf = new byte [16];
udpClient.Send (sendbuf, "255.255.255.255", 12345);
Console.WriteLine ($"UDP message sent");
} catch (Exception e) {
Console.WriteLine($"Exception: {e.Message}");
} Would you be able to provide a working .NET 7 project we can use to diagnose this?
One potential reason could be if you updated your iOS device to a new iOS version. |
Actually I think this is the case, I tried on an iPhone with iOS 15.7, and the UDP call worked. |
So what does this mean moving forward? Is this a new restriction on iOS that makes it so I can't do what I need to do or is this something your team can fix? |
I'm not sure: if you can create a working Xcode sample, we can look into if we're doing something wrong and fix it. If you can't create a working Xcode sample, then there's no way for this to work in a .NET project either. |
I found this article that says my app must be signed with the multicast entitlement even for broadcast operations. It also talks about making sure that I don't assume the interface name is 'en0'. I know the C# APIs don't allow me to specify en0 as far as I can tell, so does the code you guys use en0 anywhere or make any assumptions about the interface name? https://developer.apple.com/documentation/technotes/tn3179-understanding-local-network-privacy |
No, we don't make any such assumptions. |
Ok. I have posted in the apple developer forums to try to get some help in creating a Swift application. Here is my post: |
Hi @jfversluis. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you. |
I believe this issue is still on going. Even though I have posted in the Apple forums I have not received any responses there. I still expect the dotnet team to help fix this. Maybe you guys can do some research and reach out to contacts at Apple that I don't have access to? |
Stackoverflow might be another place to ask.
The fact that a restricted entitlement seems to be required to make this work makes it more complicated, because it unfortunately means we can't create a working sample project.
We don't have any contacts for issues like this, the recommended way is to do as you did (post in the Apple forums), alternatively raise a code-level support request with Apple (https://developer.apple.com/support/technical/). |
Issue moved from dotnet/maui#26628
From @tpitman on Saturday, December 14, 2024 5:25:44 AM
Description
I have a MAUI ios and android app. I originally created it with net7 and then updated it to net8.
I use the following code to "ping" a device on my network that I also created:
This is how discover the IP address of my device. The I can connect to it.
This was working fine when I would build and deploy it from VS for Mac several months ago.
I then didn't work on it for several months.
Since that time I have started using VSCode on my mac. when I went to build it today, however, I was not able to debug it for some reason.
So I set up Visual Studio 2022 on a VM in Parallels on my mac.
I am able to build and debug, but now when I hit the udpClient.Send I get an exception that "no route is found".
When I search for that it talks about needing the multicast entitlement from Apple for my app.
If that is the case why did it used to work? Posts about that have been around for a long time...
The first time I run my app after initial installation the app does ask for permission to search for device on the local network and I Allow it.
It doesn't ask again unless I remove the app from the phone first.
I tried updated the app to net9 to see if that would make a difference and it doesn't.
I then posted a question on the Microsoft Answer site here:
https://learn.microsoft.com/en-us/answers/questions/2127840/multicast-udp-packets-stopped-working?comment=answer-1885404&page=1#comment-1860593
Some answered that it was because I didn't have the proper Entitlements.plist with the entry about multicast. I didn't think that was it because it wasn't there when it was working and that entitlement has been around a while.
I didn't have any other ideas, so I contacted apple and requested permission to have that capability on this app.
They granted it and I added the proper entitlement to the file and created a new provisioning profile.
This still gave the exact same error at the exact same place.
So I think this is a bug or change that I need help with.
Please help.
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
9.0.21 SR2.1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.40 SR5
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: