For some reason I do not know sometimes my device does not receive an answer from ntp server and got stuck in the read socket. I try to solve this using a select. But I am a