TimeService hang on G120

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 due to socket.connect issues?

Hangs the thread or the whole system?

The whole system. Can’t break it with debug

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

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();

Yes, that’s my sense too

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

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

1 Like

@ Gus -

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

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

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

@ andre.m - Thanks man!

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

@ eolson - Thank you! It worked perfectly!