Code Monkey home page Code Monkey logo

Comments (6)

adolgov avatar adolgov commented on August 20, 2024

Same behavior (same exception type/message in ErrorOccurred event) when using the non-async calls

var client = new NtpClient(KnownNtpServers.NorthAmericaOrg);

client.TimeReceived += Client_TimeReceived;
client.ErrorOccurred += Client_ErrorOccurred;
client.BeginRequestTime();

from yort.ntp.

Yortw avatar Yortw commented on August 20, 2024

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.

from yort.ntp.

adolgov avatar adolgov commented on August 20, 2024

Thank you for your response.

Let me know if I can help test a potential solution.

from yort.ntp.

Yortw avatar Yortw commented on August 20, 2024

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.

from yort.ntp.

adolgov avatar adolgov commented on August 20, 2024

The new version works. Thanks for the quick fix!

from yort.ntp.

Yortw avatar Yortw commented on August 20, 2024

No problem. Thanks for reporting it.

from yort.ntp.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.