simplified code by using udp_broadcast_new.

This commit is contained in:
nvt-se 2009-04-13 19:55:15 +00:00
parent 9765df97e5
commit c0fb680f12

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rime-udp.c,v 1.2 2009/04/06 13:27:37 nvt-se Exp $ * $Id: rime-udp.c,v 1.3 2009/04/13 19:55:15 nvt-se Exp $
*/ */
/** /**
@ -77,12 +77,10 @@ PROCESS_THREAD(rime_udp_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
uip_create_linklocal_allnodes_mcast(&ipaddr); broadcast_conn = udp_broadcast_new(HTONS(RIME_UDP_PORT), NULL);
broadcast_conn = udp_new(&ipaddr, HTONS(RIME_UDP_PORT), NULL);
if(broadcast_conn == NULL) { if(broadcast_conn == NULL) {
PRINTF("rime-udp: Failed to allocate a broadcast connection!\n"); PRINTF("rime-udp: Failed to allocate a broadcast connection!\n");
} }
udp_bind(broadcast_conn, HTONS(RIME_UDP_PORT));
uip_create_unspecified(&ipaddr); uip_create_unspecified(&ipaddr);
unicast_conn = udp_new(&ipaddr, HTONS(RIME_UDP_PORT), NULL); unicast_conn = udp_new(&ipaddr, HTONS(RIME_UDP_PORT), NULL);