Rewrote the code to use the servreg-hack module, so that clients can look up the IP address of the collector node.

This commit is contained in:
adamdunkels 2010-06-15 19:02:00 +00:00
parent 5dc55f0a1b
commit 237398a74b
2 changed files with 28 additions and 28 deletions

View file

@ -33,6 +33,8 @@
#include "net/uip.h"
#include "net/rpl/rpl.h"
#include "servreg-hack.h"
#include "net/netstack.h"
#include "dev/button-sensor.h"
#include <stdio.h>
@ -48,6 +50,8 @@
#define UDP_CLIENT_PORT 8765
#define UDP_SERVER_PORT 5678
#define UDP_EXAMPLE_ID 190
static struct uip_udp_conn *server_conn;
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
@ -101,6 +105,10 @@ PROCESS_THREAD(udp_server_process, ev, data)
PROCESS_BEGIN();
servreg_hack_init();
servreg_hack_register(UDP_EXAMPLE_ID);
PROCESS_PAUSE();
SENSORS_ACTIVATE(button_sensor);