mirror of https://github.com/ARMmbed/mbed-os.git
Added check for packet address in ipv4 nist test
parent
1826978e8c
commit
47018fe1ac
|
|
@ -42,11 +42,12 @@ int main() {
|
||||||
int ret_send = sock.sendto(nist, (void*)ntp_send_values, sizeof(ntp_send_values));
|
int ret_send = sock.sendto(nist, (void*)ntp_send_values, sizeof(ntp_send_values));
|
||||||
printf("UDP: Sent %d Bytes to NTP server \n", ret_send);
|
printf("UDP: Sent %d Bytes to NTP server \n", ret_send);
|
||||||
|
|
||||||
const int n = sock.recvfrom(NULL, (void*)ntp_recv_values, sizeof(ntp_recv_values));
|
SocketAddress source;
|
||||||
|
const int n = sock.recvfrom(&source, (void*)ntp_recv_values, sizeof(ntp_recv_values));
|
||||||
|
|
||||||
printf("UDP: Recved from NTP server %d Bytes \n", n);
|
printf("UDP: Recved from NTP server %d Bytes \n", n);
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0 && strcmp(source.get_ip_address(), nist.get_ip_address()) == 0) {
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
printf("UDP: Values returned by NTP server: \n");
|
printf("UDP: Values returned by NTP server: \n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue