Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Натура Антон, 3530901/70201 #29

Closed
wants to merge 1 commit into from

Conversation

antoshka77
Copy link

Вторая лабораторная, отчёт находится в lab2/README.md.

@wrbbz wrbbz added the Вторая лабораторная Реальные UDP протоколы label Nov 30, 2020
@wrbbz
Copy link
Contributor

wrbbz commented Jan 10, 2021

  • DNS - зачет
  • NTP. При попытке запроса времени у сервера, сервер выплевывает исключения. В отчете можно описать как проводилось тестирование сервера. Например, запуск сервера, с такими-то аргументами. И на сервер кидаются запросы такого-то формата.
    Сейчас:

Клиент:

➜ 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)

@antoshka77
Copy link
Author

antoshka77 commented Jan 11, 2021

Для тестирования я пытался найти клиент попроще чем системный 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

Я не уверен, что дальше делать.

@wrbbz
Copy link
Contributor

wrbbz commented Jan 11, 2021

Тестирование с другими клиентами дало положительный результат.
Моя ошибка.

А описание тестирования, которое ты делал, можно в отчет добавить. Лишним не будет.

Зачтено

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Вторая лабораторная Реальные UDP протоколы Зачтено
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants