Changeset 967 for pjproject


Ignore:
Timestamp:
Feb 18, 2007 1:50:01 AM (18 years ago)
Author:
bennylp
Message:

Added TCP transport in sipstateless sample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/samples/sipstateless.c

    r956 r967  
    2121 * sipcore.c 
    2222 * 
    23  * This program is only used to measure the footprint of the SIP core. 
    24  * When UDP transport is included (with HAS_UDP_TRANSPORT macro), the 
    25  * executable will respond any incoming requests with 501 (Not Implemented) 
    26  * response statelessly. 
     23 * A simple program to respond any incoming requests (except ACK, of course!) 
     24 * with any status code (taken from command line argument, with the default 
     25 * is 501/Not Implemented). 
    2726 */ 
    2827 
     
    3736#define HAS_UDP_TRANSPORT 
    3837 
     38/* If this macro is set, TCP transport will be initialized at port 5060 */ 
     39#define HAS_TCP_TRANSPORT 
    3940 
    4041/* Log identification */ 
     
    141142#endif 
    142143 
     144#ifdef HAS_TCP_TRANSPORT 
     145    /*  
     146     * Add UDP transport, with hard-coded port  
     147     */ 
     148    { 
     149        pj_sockaddr_in addr; 
     150 
     151        addr.sin_family = PJ_AF_INET; 
     152        addr.sin_addr.s_addr = 0; 
     153        addr.sin_port = pj_htons(5060); 
     154 
     155        status = pjsip_tcp_transport_start(sip_endpt, &addr, 1, NULL); 
     156        if (status != PJ_SUCCESS) { 
     157            PJ_LOG(3,(THIS_FILE,  
     158                      "Error starting TCP transport (port in use?)")); 
     159            return 1; 
     160        } 
     161    } 
     162#endif 
     163 
    143164    /* 
    144165     * Register our module to receive incoming requests. 
Note: See TracChangeset for help on using the changeset viewer.