Exemple #1
0
 internal void ValidateReply(NtpPacket request)
 {
     if (Mode != NtpMode.Server)
     {
         throw new NtpException(this, "This is not a reply SNTP packet.");
     }
     if (VersionNumber == 0)
     {
         throw new NtpException(this, "Protocol version of the reply is not specified.");
     }
     if (Stratum == 0)
     {
         throw new NtpException(this, String.Format("Received Kiss-o'-Death SNTP packet with code 0x{0:x}.", ReferenceId));
     }
     if (LeapIndicator == NtpLeapIndicator.AlarmCondition)
     {
         throw new NtpException(this, "SNTP server has unsynchronized clock.");
     }
     CheckTimestamps();
     if (OriginTimestamp != request.TransmitTimestamp)
     {
         throw new NtpException(this, "Origin timestamp in reply doesn't match transmit timestamp in request.");
     }
 }
Exemple #2
0
 internal NtpException(NtpPacket packet, String message)
     : base(message)
 {
     Packet = packet;
 }