Pergunta

I am trying to query an NTP Server using c# to get the time of NTP server using the following source code from this thread How to Query an NTP Server using C#? .For some reason the flow stops at socket.Receive(ntpData).

1) Any idea why it is stopping?

2)How to get the time from a ntp server using windows command line so that if it works than my program should work .

Foi útil?

Solução

1) The most likely reason your program is stopping is because of no network response this can be caused by the network blocking for Udp, port 123 etc.

2) You can use the ntpq program to query from command line (NTP)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top