Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

Tutorials for Sending and Receiving Raw UDP Datagrams using Contiki-Ng Simulator

Send And Receive Raw UDP Datagrams With Contiki-Ng

Contiki-Ng Simulator Steps for Sending and Receiving Raw UDP Datagrams

  • Description:It describes how to send and receive raw UDP datagrams with Contiki-NG. It focus on the module simple-udp.
Step-1
  • Open the file location -->/home/user/Desktop/contiki-ng/os/net/ipv6
    simple-udp.c file
    First, register a socket, both at the sender and receiver.
    #include "net/ipv6/simple-udp.h"
    simple_udp_register(struct simple_udp_connection *c,
    uint16_t local_port,
    uip_ipaddr_t *remote_addr,
    uint16_t remote_port,
    simple_udp_callback receive_callback)
Step-2
  • For each incoming datagram, the function above will be called with parameters that provide source/destination addresses and ports, and the payload.
    c->receive_callback(c,
    &(UIP_IP_BUF->srcipaddr),
    UIP_HTONS(UIP_UDP_BUF->srcport),
    &(UIP_IP_BUF->destipaddr),
    UIP_HTONS(UIP_UDP_BUF->destport),
    databuffer, uip_datalen());