Print out sender IPv6 address when receiving data. When sending data, include a counter in the message.
This commit is contained in:
parent
6220e231a2
commit
722b6e0b96
|
@ -67,7 +67,9 @@ receiver(struct simple_udp_connection *c,
|
|||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
printf("Data received on port %d from port %d with length %d: '%s'\n",
|
||||
printf("Data received from ");
|
||||
uip_debug_ipaddr_print(sender_addr);
|
||||
printf(" on port %d from port %d with length %d: '%s'\n",
|
||||
receiver_port, sender_port, datalen, data);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -118,12 +118,14 @@ PROCESS_THREAD(unicast_sender_process, ev, data)
|
|||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
|
||||
addr = servreg_hack_lookup(SERVICE_ID);
|
||||
if(addr != NULL) {
|
||||
static unsigned int message_number;
|
||||
char buf[20];
|
||||
|
||||
printf("Sending unicast to ");
|
||||
uip_debug_ipaddr_print(addr);
|
||||
printf("\n");
|
||||
sprintf(buf, "From %d", node_id);
|
||||
sprintf(buf, "Message %d", message_number);
|
||||
message_number++;
|
||||
simple_udp_sendto(&unicast_connection, buf, strlen(buf) + 1, addr);
|
||||
} else {
|
||||
printf("Service %d not found\n", SERVICE_ID);
|
||||
|
|
Loading…
Reference in a new issue