This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Клиент: ➜ ntpq -c 'rv 0 clock' localhost
localhost: timed out, nothing received
***Request timed out Сервер: > Task :lab2-ntp-server:run
18:59:42.813 [DefaultDispatcher-worker-3] INFO com.github.antoshka77.inet.dns.Server - incoming datagram from /0:0:0:0:0:0:0:1:45739
18:59:42.828 [DefaultDispatcher-worker-3] ERROR com.github.antoshka77.inet.dns.Server - ntp format error: Premature end of stream: expected 4 bytes
18:59:42.837 [DefaultDispatcher-worker-3] INFO com.github.antoshka77.inet.dns.Server - sent error: Packet(leap=NoWarning, version=4, mode=Server, stratum=com.github.antoshka77.inet.ntp.Packet$Stratum$Unspecified@348062d6, poll=0, precision=0, rootDelay=NTPTime(seconds=0, fraction=0), rootDispersion=NTPTime(seconds=1, fraction=0), referenceId=DENY, originTimestamp=NTPTime(seconds=0, fraction=0), receiveTimestamp=NTPTime(seconds=0, fraction=0), transmitTimestamp=NTPTime(seconds=0, fraction=0), destinationTimestamp=NTPTime(seconds=0, fraction=0))
java.io.EOFException: Premature end of stream: expected 4 bytes
at io.ktor.utils.io.core.StringsKt.prematureEndOfStream(Strings.kt:481)
at io.ktor.utils.io.core.InputPrimitivesKt.readIntFallback(InputPrimitives.kt:86)
at io.ktor.utils.io.core.InputPrimitivesKt.readInt(InputPrimitives.kt:17)
at com.github.antoshka77.inet.ntp.NTPTimeKt.readNTPTimestamp(NTPTime.kt:28)
at com.github.antoshka77.inet.ntp.Packet$Companion.decode(Packet.kt:95)
at com.github.antoshka77.inet.dns.ServerKt.main(Server.kt:58)
at com.github.antoshka77.inet.dns.ServerKt$main$1.invokeSuspend(Server.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:362)
at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:479)
at kotlinx.coroutines.channels.AbstractChannel$ReceiveElement.completeResumeReceive(AbstractChannel.kt:899)
at kotlinx.coroutines.channels.AbstractSendChannel.offerInternal(AbstractChannel.kt:56)
at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:135)
at kotlinx.coroutines.channels.ChannelCoroutine.send$suspendImpl(ChannelCoroutine.kt)
at kotlinx.coroutines.channels.ChannelCoroutine.send(ChannelCoroutine.kt)
at io.ktor.network.sockets.DatagramSocketImpl$receiver$1.invokeSuspend(DatagramSocketImpl.kt:41)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
18:59:47.844 [DefaultDispatcher-worker-1] INFO com.github.antoshka77.inet.dns.Server - incoming datagram from /0:0:0:0:0:0:0:1:45739
18:59:47.845 [DefaultDispatcher-worker-1] ERROR com.github.antoshka77.inet.dns.Server - ntp format error: Premature end of stream: expected 4 bytes
18:59:47.848 [DefaultDispatcher-worker-1] INFO com.github.antoshka77.inet.dns.Server - sent error: Packet(leap=NoWarning, version=4, mode=Server, stratum=com.github.antoshka77.inet.ntp.Packet$Stratum$Unspecified@348062d6, poll=0, precision=0, rootDelay=NTPTime(seconds=0, fraction=0), rootDispersion=NTPTime(seconds=1, fraction=0), referenceId=DENY, originTimestamp=NTPTime(seconds=0, fraction=0), receiveTimestamp=NTPTime(seconds=0, fraction=0), transmitTimestamp=NTPTime(seconds=0, fraction=0), destinationTimestamp=NTPTime(seconds=0, fraction=0))
java.io.EOFException: Premature end of stream: expected 4 bytes
at io.ktor.utils.io.core.StringsKt.prematureEndOfStream(Strings.kt:481)
at io.ktor.utils.io.core.InputPrimitivesKt.readIntFallback(InputPrimitives.kt:86)
at io.ktor.utils.io.core.InputPrimitivesKt.readInt(InputPrimitives.kt:17)
at com.github.antoshka77.inet.ntp.NTPTimeKt.readNTPTimestamp(NTPTime.kt:28)
at com.github.antoshka77.inet.ntp.Packet$Companion.decode(Packet.kt:95)
at com.github.antoshka77.inet.dns.ServerKt.main(Server.kt:58)
at com.github.antoshka77.inet.dns.ServerKt$main$1.invokeSuspend(Server.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:362)
at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:479)
at kotlinx.coroutines.channels.AbstractChannel$ReceiveElement.completeResumeReceive(AbstractChannel.kt:899)
at kotlinx.coroutines.channels.AbstractSendChannel.offerInternal(AbstractChannel.kt:56)
at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:135)
at kotlinx.coroutines.channels.ChannelCoroutine.send$suspendImpl(ChannelCoroutine.kt)
at kotlinx.coroutines.channels.ChannelCoroutine.send(ChannelCoroutine.kt)
at io.ktor.network.sockets.DatagramSocketImpl$receiver$1.invokeSuspend(DatagramSocketImpl.kt:41)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) |
Для тестирования я пытался найти клиент попроще чем системный ntp демон. Нашёл далеко не самый лучший вариант https://github.com/lettier/ntpclient. Можно попробовать доработать и тестировать с помощью ntpq, но меня смущает то, что ntpq при таком же запросе не смогла получить ответ от сервера 0.ru.pool.ntp.org. При этом то, с помощью чего я тестировал свой сервер, получает ответ от 0.ru.pool.ntp.org. > ntpq -c 'rv 0 clock' 0.ru.pool.ntp.org
0.ru.pool.ntp.org: timed out, nothing received
***Request timed out
> ./ntpclient.py # host = "0.ru.pool.ntp.org"
Time = Mon Jan 11 05:56:48 2021 Я не уверен, что дальше делать. |
Тестирование с другими клиентами дало положительный результат. А описание тестирования, которое ты делал, можно в отчет добавить. Лишним не будет. Зачтено |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Вторая лабораторная, отчёт находится в lab2/README.md.