Ignore:
Timestamp:
Nov 7, 2005 6:14:08 PM (19 years ago)
Author:
bennylp
Message:

UDP echo testing in Linux

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/main/pjlib/src/pjlib-test/echo_clt.c

    r6 r19  
    4242    pj_str_t s; 
    4343    pj_status_t rc; 
     44    pj_uint32_t buffer_id; 
     45    pj_uint32_t buffer_counter; 
     46    pj_uint32_t timeout_counter=0, invalid_counter=0; 
    4447    struct client *client = arg; 
    4548    pj_status_t last_recv_err = PJ_SUCCESS, last_send_err = PJ_SUCCESS; 
     
    7881    //PJ_LOG(3,("", "...thread %p running", pj_thread_this())); 
    7982 
     83    buffer_id = (pj_uint32_t) pj_thread_this(); 
     84    buffer_counter = 0; 
     85 
     86    *(pj_uint32_t*)send_buf = buffer_id; 
     87 
    8088    for (;;) { 
    8189        int rc; 
    8290        pj_ssize_t bytes; 
     91        pj_uint32_t *p_buffer_id, *p_buffer_counter; 
    8392 
    8493        ++counter; 
     94 
     95        while (wait_socket(sock,0) > 0) 
     96            ; 
    8597 
    8698        /* Send a packet. */ 
    8799        bytes = BUF_SIZE; 
     100        *(pj_uint32_t*)(send_buf+4) = ++buffer_counter; 
    88101        rc = pj_sock_send(sock, send_buf, &bytes, 0); 
    89102        if (rc != PJ_SUCCESS || bytes != BUF_SIZE) { 
     
    101114            PJ_LOG(3,("", "...timeout")); 
    102115            bytes = 0; 
     116            timeout_counter++; 
    103117        } else if (rc < 0) { 
    104118            rc = pj_get_netos_error(); 
Note: See TracChangeset for help on using the changeset viewer.