Main Site Documentation

TimeService hang on G120


#1

A call to TimeService.Start() will hang when the defined timeservers (Prim & Alt) are not reachable.

Anyone knows if this is know / expected behavior on G120 / netmf 4.2.11.0 due to socket.connect issues?


#2

Hangs the thread or the whole system?


#3

The whole system. Can’t break it with debug


#4

can you replicate it with UDP connection? This is very strange. Any example code for us to try?


#5

I already implemented a work around using UDP and separate socket connect test to overcome the problem. You can easily make a small test, disconnecting your router from the internet just before the code executes TimeService.Start();


#6

Yes, that’s my sense too


#7

There is a very big difference between block and system lockup.


#8

For me, it would lock everything up for 40 seconds, even if the servers were available. (for some reason, it always takes two tries to get a response from the NTP server from my network).

I wrote a “non thread-blocking” replacement for TimeService that added DTS if that would be useful. https://www.ghielectronics.com/community/codeshare/entry/749


#9

@ Gus -

I agree only from a technical standpoint. To an end user there’s no difference


#10

There is difference. You can use a thread that you terminate with first case.


#11

@ eolson - Hi! Is it possible that you show an example of how to use your version of TimeService?
Thanks


#12

@ andre.m - Thanks man!


#13

There is an example in the codeshare related forum thread: https://www.ghielectronics.com/community/forum/topic?id=12487


#14

@ eolson - Thank you! It worked perfectly!