diff --git a/examples/ipv6/rpl-udp/udp-client.c b/examples/ipv6/rpl-udp/udp-client.c index c7c425c7b..e5b27f832 100644 --- a/examples/ipv6/rpl-udp/udp-client.c +++ b/examples/ipv6/rpl-udp/udp-client.c @@ -78,7 +78,7 @@ send_packet(void *ptr) seq_id++; PRINTF("DATA send to %d 'Hello %d'\n", - client_conn->ripaddr.u8[15], seq_id); + server_ipaddr.u8[sizeof(server_ipaddr.u8) - 1], seq_id); sprintf(buf, "Hello %d from the client", seq_id); uip_udp_packet_sendto(client_conn, buf, strlen(buf), &server_ipaddr, UIP_HTONS(UDP_SERVER_PORT)); diff --git a/examples/ipv6/rpl-udp/udp-server.c b/examples/ipv6/rpl-udp/udp-server.c index 0a5f83e93..2ce2a046d 100644 --- a/examples/ipv6/rpl-udp/udp-server.c +++ b/examples/ipv6/rpl-udp/udp-server.c @@ -64,7 +64,8 @@ tcpip_handler(void) appdata = (char *)uip_appdata; appdata[uip_datalen()] = 0; PRINTF("DATA recv '%s' from ", appdata); - PRINTF("%d", UIP_IP_BUF->srcipaddr.u8[15]); + PRINTF("%d", + UIP_IP_BUF->srcipaddr.u8[sizeof(UIP_IP_BUF->srcipaddr.u8) - 1]); PRINTF("\n"); #if SERVER_REPLY uip_ipaddr_copy(&server_conn->ripaddr, &UIP_IP_BUF->srcipaddr);