Use variable UDP port for map.

This commit is contained in:
gym487 2022-04-17 00:56:54 +08:00
parent a70a50961f
commit a6809b81fb
3 changed files with 8 additions and 6 deletions

View File

@ -119,7 +119,7 @@ Options:
-i Disable ionospheric delay for spacecraft scenario
-v Show details about simulated channels
-n <port> Use TCP connection to Gnuradio TCP-Source for realtime simulation.
-w Connect with map server(/mapserver/mapper.py) by udp on port 5678.
-w <port> Connect with map server(/mapserver/mapper.py) by UDP (default port 5678).
```
The user motion can be specified in either dynamic or static mode:

View File

@ -1667,7 +1667,7 @@ void usage(void)
" -i Disable ionospheric delay for spacecraft scenario\n"
" -v Show details about simulated channels\n"
" -n <port> 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 <port> 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);

View File

@ -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]);