Changeset 1852 for pjproject/trunk/pjnath/src/pjturn-srv/main.c
- Timestamp:
- Mar 9, 2008 12:55:00 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjturn-srv/main.c
r1812 r1852 1 1 #include "turn.h" 2 3 int err(const char *title, pj_status_t status) 4 { 5 char errmsg[PJ_ERR_MSG_SIZE]; 6 pj_strerror(status, errmsg, sizeof(errmsg)); 7 8 printf("%s: %s\n", title, errmsg); 9 return 1; 10 } 11 12 int main() 13 { 14 pj_caching_pool cp; 15 pj_turn_srv *srv; 16 pj_turn_listener *listener; 17 pj_status_t status; 18 19 status = pj_init(); 20 if (status != PJ_SUCCESS) 21 return err("pj_init() error", status); 22 23 pj_caching_pool_init(&cp, NULL, 0); 24 25 status = pj_turn_srv_create(&cp.factory, &srv); 26 if (status != PJ_SUCCESS) 27 return err("Error creating server", status); 28 29 status = pj_turn_listener_create_udp(srv, pj_AF_INET(), NULL, 3478, 1, 0, &listener); 30 if (status != PJ_SUCCESS) 31 return err("Error creating listener", status); 32 33 status = pj_turn_srv_add_listener(srv, listener); 34 if (status != PJ_SUCCESS) 35 return err("Error adding listener", status); 36 37 puts("Server is running"); 38 puts("Press <ENTER> to quit"); 39 40 { 41 char line[10]; 42 fgets(line, sizeof(line), stdin); 43 } 44 45 pj_turn_srv_destroy(srv); 46 pj_caching_pool_destroy(&cp); 47 pj_shutdown(); 48 49 return 0; 50 } 51
Note: See TracChangeset
for help on using the changeset viewer.