How to get the Round Trip Time of CoAP message during transmission in cooja simulator?

Description

The round-trip time (RTT) in CoAP is the length of time taken to a signal to be sent plus the length of taken to be an acknowledgment received. This time delay paths between the two communication endpoints.

   Files to be modified, File
location:

   Contiki/ apps/er
- coap er-coap-transactions.c

   Open above highlighted
file in a location: Do following
modification to calculate RTT

Code:

if(t->retrans_counter <= COAP_MAX_RETRANSMIT){

//August: Check if this was a CONFIRMABLE
that actually provides
RTT measurements

if(COAP_TYPE_CON==
((COAP_HEADER_TYPE_MASK & t->packet
[0])>>COAP_HEADER_TYPE_POSITION)){

//AUGUST: before clearing
transaction store RTT info

clock_time_t rtt = clock_time()
- t->timestamp;

printf("CoAP ACK packet
received-RTT--%lu\n",rtt);

Open Cooja:

   Cmd: cd contiki/ tools/
cooja --> press enter

ant run --> enter

   File -new simulation (or)
(ctrl+ n).

   Open motes menu >> add motes >>
create new motes type In
order to create the motes,

   i. border- router.c

   ii. er-example-server.c

   iii. er-example-client.c

   Now connect the server to
border router.

   make connect-router-
cooja

6a
Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit