c++ - Custom NTP client getting wrong timestamps -


i'm trying implement own ntp client. can send request ntp server , response. in response looks correct, except 4 timestamps wrong. i've looked message sent ntp server in wireshark , there correct. example, data wireshark displaying reference timestamp

d8 c6 36 c3 ae 40 00 00

and program gets refernece timestamp

d8 c6 3f 1d b0 00 00 00

my code receiving data ntp server looks this:

addr_len = sizeof(their_addr); uint8_t buffer[64]; memset(&buffer, 0, sizeof(buffer)); recvfrom(sockfd, (char*)buffer, sizeof(buffer), 0, (sockaddr*)&their_addr, &addr_len); 

can me figure out things going wrong?

i figured out wrong. forgot convert timestamps recieved network byte order host byte order.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -