Code Monkey home page Code Monkey logo

guerrillantp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

guerrillantp's Issues

A few things

  1. Your code looks great! Just publish the new version whenever you're able to.
  2. I noticed that you're now targeting .NET 5.0 and seem to have dropped support for .NET 4.8. I don't know if that was intentional or not.
  3. I noticed that you're targeting .NET 5.0, but this should likely be 6.0 since 5.0 is out of support.
  4. When I build, I get Analyzer suggestions recommending usage of AsSpan() to increase performance.
  5. Can you enable Discussions on this repo?

Socket error on Azure app service

I'm getting this error:

Error: System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10014): The system detected an invalid pointer address in attempting to use a pointer argument in a call. [::ffff:194.117.47.42]:123
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at GuerrillaNtp.NtpClient.Connect()
at GuerrillaNtp.NtpClient.Query()

When using in a Azure App, running local don't throw error.

Code used

//NtpClient client = new NtpClient("ntp02.oal.ul.pt");
NtpClient client = new NtpClient(IPAddress.Parse("194.117.47.42"));
NtpClock clock = client.Query();

Any idea how to solve this?

Cheers

Jorge

[Feature Request] Work in Unity 2021.3 and above

This is not an issue but rather a feature request.

Tried in Unity 2021.3 and above that the version 3 didn't work. Downgraded to version 2 worked perfectly.

Just hope that this wonderful library can be used inside Unity editor.

SetDateTime64 Overflow Exception

Passing in a time >= year 2037 to function:
void SetDateTime64(int offset, DateTime? value) { SetUInt64BE(offset, value == null ? 0 : Convert.ToUInt64((value.Value.Ticks - epoch.Ticks) * (0.0000001 * (1L << 32)))); }
causes the conversion to UInt64 to overflow.

Test Program:


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime EpochFuture = new DateTime(2037, 1, 1);
            DateTime EpochPast = new DateTime(1900, 1, 1);
            try
            {
                UInt64 Result = Convert.ToUInt64((EpochFuture.Ticks - EpochPast.Ticks) * (0.0000001 * (1L << 32)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
}

Output:
System.OverflowException: Arithmetic operation resulted in an overflow.
at System.Convert.ToUInt64(Double value)
at ConsoleApp1.Program.Main(String[] args) in MyProgram

Plans to support NTS ?

Dear authors of GuerrillaNtp,

Are there any plans to support Network Time Security (NTS), as specified on RFC 8915 ?

Timeout not working when using Async methods

Tested with GuerillaNtp v3.0.0 & .NET for macOS

Code:

var ntpClient = new NtpClient(NtpClient.DefaultEndpoint, TimeSpan.FromSeconds(0.001));
var clock = await ntpClient.QueryAsync().ConfigureAwait(false);

Expected behaviour:
OperationCanceledException or similar Exception

Actual behaviour:
Timeout is ignored. QueryAsync can be awaited for much longer, potentially indefinitely, without any exception being thrown.

The docs only mention that the synchronous Receive method might use this timeout.
https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.receivetimeout?view=net-7.0

There's also another Timeout, for synchronous Send methods, currently it doesn't seem to be used anywhere in this library: https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.sendtimeout?view=net-7.0

If this is expected behaviour, it should be explained in detail in the docs. It currently only says "Query timeout" which is pretty vague. I expected this to be a timeout for any method (async or synchronous) that I call on the NtpClient method (and not on the underlying socket). I think the timeout should be implemented differently, perhaps using a CancellationTokenSource and CancelAfter

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.