A port and bug fix of Alix955/code/ntp-client. The socket would hang as it was defined both with a timeout and as blocking.
Diff: NTPClient.cpp
- Revision:
- 1:099750f42b02
- Parent:
- 0:3c1170035e2b
- Child:
- 2:a3aec199dc7c
--- a/NTPClient.cpp Tue Dec 04 17:36:03 2018 +0000 +++ b/NTPClient.cpp Fri Dec 07 13:07:56 2018 +0000 @@ -20,6 +20,7 @@ if (ret_gethostbyname < 0) { // Network error on DNS lookup + printf("Error on DNS lookup : %d\n" , ret_gethostbyname); return ret_gethostbyname; } @@ -44,9 +45,11 @@ } else { if (n < 0) { // Network error + printf("Network error: %d\n", n); return n; } else { // No or partial data returned + printf("No or partial data returned: -1"); return -1; } }