How to set payload in server side in COAP using contiki cooja?

To know about how to set payload in server side in COAP using contiki cooja simulator.

Description

To know about how to set payload in server side in COAP using contiki cooja simulator.

  • Step 1: Open a file at location:
    home/user/contiki/examples/er-rest-examples/er-example-client.c
    Payload set for client side
    coap_set_payload(request, (uint8_t *)msg, sizeof(msg) – 1);
    function set payload,

  • Step 2: contiki/apps/er-coap/er-coap-engine.c

  • Payload set for sever side
    For example,
    Char * res_msg = “Pressure”
    coap_set_payload(response, res_msg, strlen(res_msg)); /* a const char str[] and sizeof(str) produces larger code size */

  • Step 3: Run the cooja simulator

Source code:
  • Step 1: Open a file at location:
    home/user/contiki/examples/er-rest-examples/er-example-client.c
    Payload set for client side
    coap_set_payload(request, (uint8_t *)msg, sizeof(msg) – 1);
    function set payload,

  • Step 2: contiki/apps/er-coap/er-coap-engine.c

  • Payload set for sever side
    For example,
    Char * res_msg = “Pressure”
    coap_set_payload(response, res_msg, strlen(res_msg)); /* a const char str[] and sizeof(str) produces larger code size */

  • Step 3: Run the cooja simulator

Leave Comment

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

clear formSubmit