examples/multipath/udpserver/udp-server.c
// function to write into shared memory after 300 ms
function to write into shared memory after 300 ms
function to write into shared memory after 300 ms
static void ctimer_callback() {
    char set_unset_value[40], anchor_node[26], mobile_node[26];
    uip_ipaddr_t  anchor_node_address;
    int i;
    memcpy(shared_memory_up, long_str, strlen(long_str));
    printf("wrote to shm upward %s \n", long_str);
    sephamore_drop_rss = 1;
    char * curLine = shared_memory_down;
    while(curLine)
    {
        char * nextLine = strchr(curLine, '\n');
        if (nextLine) *nextLine = '\0';  
        printf("curLine=[%s]\n", curLine);
        memset(anchor_node, 0, 26*sizeof(char));
        sscanf(curLine, "%s %s for %s", set_unset_value, anchor_node, mobile_node);
        if(!uiplib_ipaddrconv(anchor_node, &anchor_node_address)) {
            return;
        }
        LOG_INFO("anchor_node = %s\tset_unset_value = %s\tmobile_node = %s\n", anchor_node, set_unset_value, mobile_node);
        if(strcmp(set_unset_value,"SET")==0){
            strcat(set_unset_value, " ");
            strcat(set_unset_value, mobile_node);
            LOG_INFO("SENDING\n");
            simple_udp_sendto(&down_conn, set_unset_value, strlen(set_unset_value), &anchor_node_address);
        }
        if (nextLine) *nextLine = '\n';  
            curLine = nextLine ? (nextLine+1) : NULL;
    }
}
static void ctimer_callback ( ) { char set_unset_value [ 40 ] , anchor_node [ 26 ] , mobile_node [ 26 ] ; uip_ipaddr_t anchor_node_address ; int i ; memcpy ( shared_memory_up , long_str , strlen ( long_str ) ) ; printf ( " \n " , long_str ) ; sephamore_drop_rss = 1 ; char * curLine = shared_memory_down ; while ( curLine ) { char * nextLine = strchr ( curLine , ' \n ' ) ; if ( nextLine ) * nextLine = ' \0 ' ; printf ( " \n " , curLine ) ; memset ( anchor_node , 0 , 26 * sizeof ( char ) ) ; sscanf ( curLine , " " , set_unset_value , anchor_node , mobile_node ) ; if ( ! uiplib_ipaddrconv ( anchor_node , & anchor_node_address ) ) { return ; } LOG_INFO ( " \t \t \n " , anchor_node , set_unset_value , mobile_node ) ; if ( strcmp ( set_unset_value , " " ) == 0 ) { strcat ( set_unset_value , " " ) ; strcat ( set_unset_value , mobile_node ) ; LOG_INFO ( " \n " ) ; simple_udp_sendto ( & down_conn , set_unset_value , strlen ( set_unset_value ) , & anchor_node_address ) ; } if ( nextLine ) * nextLine = ' \n ' ; curLine = nextLine ? ( nextLine + 1 ) : NULL ; } }
function to write into shared memory after 300 ms
function to write into shared memory after 300 ms
// Entering data into shared memory //LOG_INFO("Sent buffer\n"); // Now reading the response // temporarily terminate the current line // then restore newline-char, just to be tidy    