sntp client in c++ for time/date [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Is there any C/C++ library to connect with a remote NTP server? I'm searching for a working code in c/c++ that gets the time and date from the server(ntp.belnet.be). It works with UDP and uses port 123. Can someone help? //sending pakket memset(&sntp_msg_header, 0, sizeof sntp_msg_header); sntp_msg_header.flags = 27; sntp_msg_header.originate_timestamp_secs = time(NULL); // Get data in rxmsg ... ... // print