EasyNTPClient
EasyNTPClient copied to clipboard
Close UDP socket after communicating with NTPServer
We should close the socket after using it. There is no reason to keep it open. If we want to destroy the first EasyNTPClient instance and then create another one later on, the socket will be taken. This will result in a failure to "ntp->begin(123)", which makes getServerTime return 0
This change cleans after the call is done.
For this patch to work you have to remove the keyword 'static' from line 43 on EasyNTPClient.cpp. Otherwise, the NTP request will succeed only once.