-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
iOS only SocketException No route to host #14224
Comments
If you create a iOS app without .NET MAUI (do |
Hi @CsabaStupak. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@jfversluis I'm a Windows developer I can't try the IOS only project. I own only an iPhone. The project seems to run only on Mac so don't know how to verify if this is the same case. |
Alright I tried it for you. Both with an iOS project without .NET MAUI and with a .NET MAUI project, running on an iOS Simulator and a physical device I can't reproduce this issue. Then tried your specific reproduction and also that one runs fine. I only modified the IP address to be one on my local network. The exception you see is to be expected since I don't have anything running on TCP port 4356. So a couple of options come to mind:
I'm leaning towards the first one since it does throw an exception that has a relevant message: no route to host. This indicates to me that the ping/connection operation is actually attempted, but fails. In both cases I don't think there is much we can do here and it will be pretty hard to diagnose on our end. Closing this for now as this doesn't seem like a bug with us from what I can tell. Good luck! |
@jfversluis Thank you very much for the fast response, really appreciate 👍 Now I don't know how to continue with this, since it works at your end. When I checked both iPhone and Android Wifi settings and also my server all are on the same network Mask = 255.255.255.0, gateway/router = 192.168.3.1. While Android does not have problem to ping the server the iPhone has. I found another Github issue #12731 maybe similar to mine where it looks like it is related to iOS version - I'm on 16.3.1. Can you tell me what version of iOS did you try the code? Maybe that is the culprit... I also tried to disable Hot Reload but it did not help. I'm a network administrator as well, so I have some knowledge to network and I do not see any issues here at least from network part. Of course maybe I do not see something what is obvious... But I have almost no experience with iPhone. Maybe you could give me some advice, what else should I check. |
Description
I have a simple Maui application (.NET7 - created from template) which communicates with a local network server. I'm testing it using Android and iPhone. The code is simple:
or another approach:
In both case the result is SocketException (65): No route to host. This happens on iPhone only. On Android it works fine.
My Android phone IP is 192.168.3.45 and iPhone IP is 192.168.3.170. Both are on the same network as the server. First time I try to connect even the "Grant access to local network" appears on iPhone, what I allowed. I can see in the iPhone settings that my application has access to local network = on.
In the project I even added the following to the Info.plist:
On my iPhone 13 mini, iOS 16.3.1 I can see the server using Fing - Network Scanner and its Device Discovery. I'm able to Ping it. So my phones are certainly on the same network. Since I can connect to the server via Android my server settings should be OK (firewall etc.). The given code works fine if I try to ping 8.8.8.8 address. So this is apparently a local network access issue - somehow iPhone ignores that setting.
Any idea what could be the problem? Thanks :-)
Steps to Reproduce
OnCounterClicked
method.Link to public reproduction project repository
https://github.com/CsabaStupak/MauiLocNetIssue.git
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.3.1
Did you find any workaround?
No workaround found and since our application is a relay between Bluetooth device and local network server so can't move forward :-(
Relevant log output
The text was updated successfully, but these errors were encountered: