From: hackbard Date: Tue, 18 May 2004 14:06:39 +0000 (+0000) Subject: first udp tries ... X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=3bffc32233a1608ba3338f39bc5193665f3095cc;p=my-code%2Fivac.git first udp tries ... --- diff --git a/src/ivac.c b/src/ivac.c index 9d2b216..47d1892 100644 --- a/src/ivac.c +++ b/src/ivac.c @@ -21,8 +21,6 @@ * */ -// #define USE_GTK - #include "ivac.h" int usage(void) { @@ -34,6 +32,7 @@ int usage(void) { puts("-h \t\t show this help"); puts("-n \t specify your name"); puts("-p \t specify port to listen for incoming connections"); + puts("-u \t specify udp data port"); puts("-d \t specify audio device"); puts(""); @@ -50,6 +49,7 @@ int main(int argc,char **argv) { /* default values */ strcpy(ivac.username,"ivac"); ivac.net.l_port=IVAC_LISTEN_PORT; + ivac.net.l_udp_port=IVAC_UDP_PORT; strcpy(ivac.audio.dsp_dev,SOUND_DEVICE); /* parse argv and change default values */ @@ -65,6 +65,9 @@ int main(int argc,char **argv) { case 'p': ivac.net.l_port=atoi(argv[++i]); break; + case 'u': + ivac.net.l_udp_port=atoi(argv[++i]); + break; case 'd': strncpy(ivac.audio.dsp_dev,argv[++i],MAX_CHAR_DEVICE); break; @@ -104,9 +107,11 @@ int main(int argc,char **argv) { ivac_shutdown(&ivac); return ERROR; } + network_udp_listen_init(&(ivac.net)); - /* add listening port + stdin to (read) event system */ + /* add listening port(s) + stdin to (read) event system */ event_math(ivac.net.l_fd,&(ivac.event),READ,ADD); + event_math(ivac.net.l_udp_fd,&(ivac.event),READ,ADD); event_math(0,&(ivac.event),READ,ADD); /* display init */ @@ -132,6 +137,7 @@ int main(int argc,char **argv) { int ivac_shutdown(t_ivac *ivac) { network_shutdown(&(ivac->net)); + network_udp_shutdown(&(ivac->net)); input_shutdown(&(ivac->input)); event_stop(&(ivac->event)); audio_shutdown(&(ivac->audio)); diff --git a/src/ivac.h b/src/ivac.h index c8ac919..2bd69c5 100644 --- a/src/ivac.h +++ b/src/ivac.h @@ -19,6 +19,7 @@ #define SUCCESS 1 #define IVAC_LISTEN_PORT 1025 +#define IVAC_UDP_PORT 1026 #define IVAC_S_SEC 2 #define IVAC_S_USEC 500