Click or drag to resize

NtpPacket Class

Represents RFC4330 SNTP packet used for communication to and from a network time server.
Inheritance Hierarchy
SystemObject
  LiteNetLib.UtilsNtpPacket

Namespace: LiteNetLib.Utils
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.2.1.0 (2026.2.1.0)
Syntax
C#
public class NtpPacket

The NtpPacket type exposes the following members.

Constructors
 NameDescription
Public methodNtpPacket Initializes default request packet.
Top
Properties
 NameDescription
Public propertyBytes Gets RFC4330-encoded SNTP packet.
Public propertyCorrectionOffset Gets the offset that should be added to local time to synchronize it with server time.
Public propertyDestinationTimestamp Gets or sets the time of reception of response SNTP packet on the client.
Public propertyLeapIndicator Gets the leap second indicator.
Public propertyMode Gets or sets SNTP packet mode, i.e. whether this is client or server packet.
Public propertyOriginTimestamp Gets or sets the time when the client sent its request.
Public propertyPoll Gets server's preferred polling interval.
Public propertyPrecision Gets the precision of server clock.
Public propertyReceiveTimestamp Gets or sets the time when the request was received by the server.
Public propertyReferenceId Gets the ID of the time source used by the server or Kiss-o'-Death code sent by the server.
Public propertyReferenceTimestamp Gets or sets the time when the server clock was last set or corrected.
Public propertyRootDelay Gets the total round-trip delay from the server to the reference clock.
Public propertyRootDispersion Gets the estimated error in time reported by the server.
Public propertyRoundTripTime Gets the round-trip time to the server.
Public propertyStratum Gets server's distance from the reference clock.
Public propertyTransmitTimestamp Gets or sets the time when the packet was sent.
Public propertyVersionNumber Gets or sets protocol version number.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodStatic memberFromServerResponse Initializes packet from data received from a server.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
Remarks

Most applications should just use the CorrectionOffset property.

The same data structure represents both request and reply packets. Request and reply differ in which properties are set and to what values.

The only real property is Bytes. All other properties read from and write to the underlying byte array with the exception of DestinationTimestamp, which is not part of the packet on network and it is instead set locally after receiving the packet.

Copied from GuerrillaNtp project with permission from Robert Vazan (@robertvazan) under MIT license, see https://github.com/RevenantX/LiteNetLib/pull/236

See Also