You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yort uses EndPoint as a parameter to Socket.Connect, the Serialize method is not implemented in Mono Linux which results in the exception below. In order to be compatible with Mono Linux/Android etc IPEndPoint could be used instead.
try {
var client = new NtpClient(_ntpServer);
Task < RequestTimeResult > task = client.RequestTimeAsync();
task.Wait();
var currentTime = task.Result;
return currentTime.NtpTime.CreateUnixTimeStamp();
} catch (Exception exception) {
_loggingService.Error($ "Error while syncing time with NTP: {exception}");
throw;
}
Yort.Ntp.NtpNetworkException: This method is not implemented by this class. ---> System.NotImplementedException: This method is not implemented by this class.
at System.Net.EndPoint.Serialize () [0x00005] in <41574d2cca96494f8f406b75a489d430>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00070] in <41574d2cca96494f8f406b75a489d430>:0
at Yort.Ntp.NtpClient.SendTimeRequest () [0x00092] in :0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in :0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in :0
at System.Threading.Tasks.Task.Wait () [0x00000] in :0
at Services.NtpSyncService.GetTime () [0x000aa] in <461fb7cf28f04e90bf48c2b50181c3b6>:0
---> (Inner Exception #0) Yort.Ntp.NtpNetworkException: This method is not implemented by this class. ---> System.NotImplementedException: This method is not implemented by this class.
at System.Net.EndPoint.Serialize () [0x00005] in <41574d2cca96494f8f406b75a489d430>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00070] in <41574d2cca96494f8f406b75a489d430>:0
at Yort.Ntp.NtpClient.SendTimeRequest () [0x00092] in :0
--- End of inner exception stack trace ---<---
The text was updated successfully, but these errors were encountered:
I looked at the code and this seems to be handled for Android. However it won't work on Mono Linux. In order for it to work for Mono Linux, IPEndpoint needs to be always used.
You're correct this was handled for Android, I didn't realise it didn't work on Linux as well.
There is a new beta package at https://www.nuget.org/packages/Yort.Ntp/3.0.1-beta (note the new package id) which you could try. This supports net8.0-android and ios targets, so in theory should work with Maui. My access to platforms for testing is somewhat limited right now, so if you do try it I'd appreciate any feedback you have on success of failure of the new package.
I have tried it in a .net 8.0 console app on WSL 2 in the Ubuntu distro, and it seems to work there now.
Yort uses EndPoint as a parameter to Socket.Connect, the Serialize method is not implemented in Mono Linux which results in the exception below. In order to be compatible with Mono Linux/Android etc IPEndPoint could be used instead.
Yort.Ntp.NtpNetworkException: This method is not implemented by this class. ---> System.NotImplementedException: This method is not implemented by this class.
at System.Net.EndPoint.Serialize () [0x00005] in <41574d2cca96494f8f406b75a489d430>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00070] in <41574d2cca96494f8f406b75a489d430>:0
at Yort.Ntp.NtpClient.SendTimeRequest () [0x00092] in :0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in :0
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in :0
at System.Threading.Tasks.Task.Wait () [0x00000] in :0
at Services.NtpSyncService.GetTime () [0x000aa] in <461fb7cf28f04e90bf48c2b50181c3b6>:0
---> (Inner Exception #0) Yort.Ntp.NtpNetworkException: This method is not implemented by this class. ---> System.NotImplementedException: This method is not implemented by this class.
at System.Net.EndPoint.Serialize () [0x00005] in <41574d2cca96494f8f406b75a489d430>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00070] in <41574d2cca96494f8f406b75a489d430>:0
at Yort.Ntp.NtpClient.SendTimeRequest () [0x00092] in :0
--- End of inner exception stack trace ---<---
The text was updated successfully, but these errors were encountered: