A burst traffic is a continuous transfer of data without interruption from one device to another.IP traffic headed in the same general direction is gathered and routed as a burst through the network in certain period.We need to create the burst traffic scenario in existing client file along with regular time interval.
Open a client file in a location :
contiki/examples/
er-rest-examples.
Includes the library for
ctimer function make available.
#include "sys/ctimer.h"
Define process for burst
traffic by adding highlighted
parts.
PROCESS(burst_traffic,
"burst traffic"); and declare function
body
Code to set burst traffic :
if(node_id = 4 || node_id = 6 || node_id = 8)
{
ctimer_set(&ct, 1536, callback, NULL);
ctimer_set(&ct1, 4480, callback, NULL);
ctimer_set(&ct2, 5888, callback, NULL);
}
static void callback(void *ptr)
{
counter++;
printf(“Callback function called at time %lu
(counter=%i)\n”, clock_seconds(), counter);
process_start(&burst_traffic, NULL);
ctimer_set(&ct, 128, callback, NULL);
if(counter==10)
{
counter=0;
ctimer_stop(&ct);
}
}
Note: Above code function is designed
to call upto 10 times for every
1 seconds.After count increases
callback stopped.
Start the network simulator
Open the Contiki cooja network
simulator and create new
simulation.
Create nodes with sky motes
for border router, server,
and client and enable required option
for simulation as we
discussed.
Now connect the server
to router.