Changeset 595 in ntrip
- Timestamp:
- Dec 12, 2007, 10:45:23 AM (17 years ago)
- Location:
- trunk/ntripclient
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ntripclient/makefile
r499 r595 1 # $Id: makefile,v 1. 3 2007/08/30 07:38:24 stoeckerExp $1 # $Id: makefile,v 1.4 2007/10/05 15:32:13 stuerze Exp $ 2 2 # probably works not with all compilers. Thought this should be easy 3 3 # fixable. There is nothing special at this source. 4 4 5 ifdef windir 6 OPTS = -Wall -W -O3 -DWINDOWSVERSION -lwsock32 7 else 8 OPTS = -Wall -W -O3 9 endif 10 5 11 ntripclient: ntripclient.c 6 $(CC) -Wall -W -O3 $? -o $@ 7 12 $(CC) $(OPTS) $? -o $@ 8 13 9 14 clean: 10 $(RM) -fntripclient core*15 $(RM) ntripclient core* 11 16 12 17 -
trunk/ntripclient/ntripclient.c
r579 r595 1 1 /* 2 2 Easy example NTRIP client for POSIX. 3 $Id: ntripclient.c,v 1.3 5 2007/10/26 14:56:47 stuerzeExp $3 $Id: ntripclient.c,v 1.36 2007/11/20 12:54:05 stoecker Exp $ 4 4 Copyright (C) 2003-2005 by Dirk Stoecker <soft@dstoecker.de> 5 5 … … 57 57 58 58 /* CVS revision and version */ 59 static char revisionstr[] = "$Revision: 1.3 5$";60 static char datestr[] = "$Date: 2007/1 0/26 14:56:47$";59 static char revisionstr[] = "$Revision: 1.36 $"; 60 static char datestr[] = "$Date: 2007/11/20 12:54:05 $"; 61 61 62 62 enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END }; … … 74 74 int bitrate; 75 75 int mode; 76 77 int udpport; 78 int initudp; 76 79 }; 77 80 … … 83 86 static struct option opts[] = { 84 87 { "bitrate", no_argument, 0, 'b'}, 85 { "data", required_argument, 0, 'd'}, 88 { "data", required_argument, 0, 'd'}, /* compatibility */ 86 89 { "mountpoint", required_argument, 0, 'm'}, 90 { "initudp", no_argument, 0, 'I'}, 91 { "udpport", required_argument, 0, 'P'}, 87 92 { "server", required_argument, 0, 's'}, 88 93 { "password", required_argument, 0, 'p'}, … … 96 101 {0,0,0,0}}; 97 102 #endif 98 #define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M: "103 #define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M:IP:" 99 104 100 105 int stop = 0; … … 293 298 args->proxyport = "2101"; 294 299 args->mode = AUTO; 300 args->initudp = 0; 301 args->udpport = 0; 295 302 help = 0; 296 303 … … 308 315 case 'd': 309 316 case 'm': 310 if(optarg && *optarg == '?') 311 args->data = encodeurl(optarg); 312 else 313 args->data = optarg; 314 break; 317 if(optarg && *optarg == '?') 318 args->data = encodeurl(optarg); 319 else 320 args->data = optarg; 321 break; 322 case 'I': args->initudp = 1; break; 323 case 'P': args->udpport = strtol(optarg, 0, 10); break; 315 324 case 'n': args->nmea = optarg; break; 316 325 case 'b': args->bitrate = 1; break; … … 552 561 /* fill structure with local address information for UDP */ 553 562 memset(&local, 0, sizeof(local)); 554 local.sin_family = AF_INET; 555 local.sin_port = htons( 0);563 local.sin_family = AF_INET; 564 local.sin_port = htons(args.udpport); 556 565 local.sin_addr.s_addr = htonl(INADDR_ANY); 557 566 len = sizeof(local); … … 670 679 exit(1); 671 680 } 681 } 682 if(args.initudp) 683 { 684 printf("Sending initial UDP packet\n"); 685 struct sockaddr_in casterRTP; 686 char rtpbuffer[12]; 687 int i; 688 rtpbuffer[0] = (2<<6); 689 /* padding, extension, csrc are empty */ 690 rtpbuffer[1] = 96; 691 /* marker is empty */ 692 rtpbuffer[2] = 0; 693 rtpbuffer[3] = 0; 694 rtpbuffer[4] = 0; 695 rtpbuffer[5] = 0; 696 rtpbuffer[6] = 0; 697 rtpbuffer[7] = 0; 698 rtpbuffer[8] = 0; 699 rtpbuffer[9] = 0; 700 rtpbuffer[10] = 0; 701 rtpbuffer[11] = 0; 702 /* fill structure with caster address information for UDP */ 703 memset(&casterRTP, 0, sizeof(casterRTP)); 704 casterRTP.sin_family = AF_INET; 705 casterRTP.sin_port = htons(((uint16_t)serverport)); 706 casterRTP.sin_addr = *((struct in_addr *)he->h_addr); 707 708 if((i = sendto(sockudp, rtpbuffer, 12, 0, 709 (struct sockaddr *) &casterRTP, sizeof(casterRTP))) != 12) 710 perror("WARNING: could not send initial UDP packet"); 672 711 } 673 712
Note:
See TracChangeset
for help on using the changeset viewer.