NtpClientOptions Class
Configuration options for NtpClient.
public sealed class NtpClientOptionsConstructors
| Name | Description |
|---|---|
| NtpClientOptions() |
NtpClientOptions()
NtpClientOptions.cspublic NtpClientOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| Port | Gets or sets the server port. Default is 123. |
| Timeout | Gets or sets the timeout for querying a single resolved address. Default is 5 seconds. Use Timeout.InfiniteTimeSpan for no timeout. |
| ValidateResponse | Gets or sets a value indicating whether responses are validated before being returned. Default is true. |
| Version | Gets or sets the NTP protocol version to use. Default is NtpVersion.V4. |
Timeout
NtpClientOptions.csGets or sets the timeout for querying a single resolved address. Default is 5 seconds. Use Timeout.InfiniteTimeSpan for no timeout.
public TimeSpan Timeout { get; set; }Property value
Remarks
A host name can resolve to several addresses, and each one gets this much time, so a query can take up to Timeout × addressCount overall. Use the cancellationToken of NtpClient.QueryAsync to bound the total duration.
ValidateResponse
NtpClientOptions.csGets or sets a value indicating whether responses are validated before being returned. Default is true.
public bool ValidateResponse { get; set; }Property value
Remarks
When enabled, a response is only accepted if its originate timestamp echoes the transmit timestamp of the request (RFC 5905 TEST2), its version is 3 or 4, its stratum is not 0 (Kiss-o'-Death), and the server does not report an alarm condition. Responses that fail are ignored and the client keeps waiting for a valid one until NtpClientOptions.Timeout elapses.
The originate timestamp is what ties a reply to this specific request, so disabling this makes the client accept a forged reply from anyone who can guess its source port. Only turn it off to interoperate with a server known to be non-compliant, and do not use the result to make a security decision. This library never authenticates the server cryptographically: it implements neither NTS (RFC 8915) nor symmetric key authentication.
Version
NtpClientOptions.csGets or sets the NTP protocol version to use. Default is NtpVersion.V4.
public NtpVersion Version { get; set; }