diff --git a/README.md b/README.md index 349314a..4d339e3 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Options: -i Disable ionospheric delay for spacecraft scenario -v Show details about simulated channels -n Use TCP connection to Gnuradio TCP-Source for realtime simulation. - -w Connect with map server(/mapserver/mapper.py) by udp on port 5678. + -w Connect with map server(/mapserver/mapper.py) by UDP (default port 5678). ``` The user motion can be specified in either dynamic or static mode: diff --git a/gpssim.c b/gpssim.c index b32bb16..d8df09a 100644 --- a/gpssim.c +++ b/gpssim.c @@ -1667,7 +1667,7 @@ void usage(void) " -i Disable ionospheric delay for spacecraft scenario\n" " -v Show details about simulated channels\n" " -n Use TCP connect to Gnuradio TCP-Source for\n realtime simulation.\n" - "-w Connect with map server(/mapserver/mapper.py) by udp on port 5678.\n", + " -w Connect with map server(/mapserver/mapper.py) by UDP (default port 5678).\n", (double)((USER_MOTION_SIZE)/10.0),(int)STATIC_MAX_DURATION); return; @@ -1740,6 +1740,7 @@ int main(int argc, char *argv[]) int webflag=0; int sockc=0; short port=1234; + short mapport=5678; //////////////////////////////////////////////////////////// // Read options @@ -1862,6 +1863,7 @@ int main(int argc, char *argv[]) usesocket=true; break; case 'w': + sscanf(optarg,"%hd",&mapport); staticLocationMode = TRUE; webflag=1; break; @@ -1872,7 +1874,7 @@ int main(int argc, char *argv[]) } if(webflag==1){ pthread_t th; - pthread_create(&th,NULL,(void *)threadrecv,NULL); + pthread_create(&th,NULL,(void *)threadrecv,(void *)&mapport); } if(usesocket==1) sockc=sockinit(port); diff --git a/socket.c b/socket.c index 3076989..8152b5f 100644 --- a/socket.c +++ b/socket.c @@ -62,10 +62,10 @@ int udprecv(int s,void *dataa,int siz){ double llhr[3]={39.68,139,76}; -void threadrecv(){ +void threadrecv(void *p){ printf("listing\n"); - short p=5678; - int s=udpinit(p); + short port=*(short*)p; + int s=udpinit(port); while(1){ udprecv(s,llhr,3*sizeof(double)); //printf("%lf%lf%lf\n",llhr[0],llhr[1],llhr[2]);