-
Notifications
You must be signed in to change notification settings - Fork 9
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
NtpNetworkException when awaiting RequestTimeAsync() #5
Comments
Same behavior (same exception type/message in var client = new NtpClient(KnownNtpServers.NorthAmericaOrg);
client.TimeReceived += Client_TimeReceived;
client.ErrorOccurred += Client_ErrorOccurred;
client.BeginRequestTime(); |
Sorry for the delayed reply, I have been away and was not in a position to do development or check GitHub. I'm also sorry this isn't working for you. It appears to just be broken. I swear I tested it on Android before publishing, but it doesn't work now and it doesn't look like it ever did so I don't know what happened. The basic problem is that Xamarin Android purports to support all the same socket API's as the desktop framework/iOS etc. but at least one of them throws a NotImplementedException and doesn't really work. Specifically calling System.Net.Sockets.Socket.Connect and passing a DnsEndPoint instance throws an exception from the EndPoint base class used by DnsEndPoint. I haven't found any way around this. I'm not sure what the point of DnsEndPoint is in Xamarin Android if you can't pass it to a socket. However, I have found the same code works with an IpEndPoint, so it may be possible to do a manual DNS resolution of the server name to IP, then pass the IP to the socket. However I haven't had time yet to confirm this, and because it's (probably) (marginally) less efficient I'd prefer to only do it on Android, so it will need either a new implementation or some conditional compilation logic in the shared code file. I'll let you know if/when I've managed to find a solution. Thanks for reporting the problem. |
Thank you for your response. Let me know if I can help test a potential solution. |
Hi, I've published a beta package (https://www.nuget.org/packages/Yort.Ntp.Portable/1.0.10-beta) to Nuget . Make sure you turn on the 'pre-release' option in VS to see the new version. I've tested it on a Samsung Galaxy S5 on Android 6.0.1 and it seems to work. Please try that package and let me know if it works for you. Thanks. |
The new version works. Thanks for the quick fix! |
No problem. Thanks for reporting it. |
I'm trying to run a basic ntp time fetch in Xamarin.Android.
While it's a simple example, I'm getting a
NtpNetworkException
with messageThis method is not implemented by this class.
The inner exception stack trace mentions:
at System.Net.EndPoint.Serialize () [0x00000] in /Users/builder/data/lanes/4009/72366f70/source/mo…
Any suggestions as to what I can try?
Version is latest from NuGet
1.0.9
The text was updated successfully, but these errors were encountered: