Changeset 24 in ntrip for trunk/ntripserver/NtripLinuxServer.c
- Timestamp:
- Jun 7, 2005, 4:47:52 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ntripserver/NtripLinuxServer.c
r23 r24 41 41 */ 42 42 43 /* $Id: NtripLinuxServer.c,v 1.1 1 2005/04/27 10:31:12stoecker Exp $43 /* $Id: NtripLinuxServer.c,v 1.12 2005/06/02 09:33:11 stoecker Exp $ 44 44 * Changes - Version 0.7 45 45 * Sep 22 2003 Steffen Tschirpke <St.Tschirpke@actina.de> … … 59 59 * - TCP sending now somewhat more stable 60 60 * - cleanup of error handling 61 * - Modes may be symbolic and not only numeric 61 62 * 62 63 * Changes - Version 0.11 … … 66 67 * - cleanup of host and port handling 67 68 * - added inactivity alarm of 60 seconds 69 * 70 * Changes - Version 0.12 71 * Jun 07 2005 Dirk Stoecker <soft@dstoecker.de> 72 * - added UDP bindmode 68 73 */ 69 74 … … 93 98 enum MODE { SERIAL = 1, TCPSOCKET = 2, INFILE = 3, SISNET = 4, UDPSOCKET = 5 }; 94 99 95 #define VERSION "NTRIP NtripServerLinux/0.1 1"100 #define VERSION "NTRIP NtripServerLinux/0.12" 96 101 #define BUFSZ 1024 97 102 … … 160 165 const char *sisnetuser = ""; 161 166 const char *initfile = NULL; 167 int bindmode = 0; 162 168 int sock_id; 163 169 char szSendBuffer[BUFSZ]; … … 174 180 exit(1); 175 181 } 176 while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:l:u:V: ")) != EOF)182 while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:l:u:V:B")) != EOF) 177 183 { 178 184 switch (c) … … 194 200 ttyport = optarg; 195 201 break; 202 case 'B': 203 bindmode = 1; 204 break; 196 205 case 'V': 197 206 if(!strcmp("3.0", optarg)) sisnetv3 = 1; … … 339 348 340 349 memset((char *) &addr, 0x00, sizeof(addr)); 341 memcpy(&addr.sin_addr, he->h_addr, (size_t)he->h_length); 350 if(!bindmode) 351 memcpy(&addr.sin_addr, he->h_addr, (size_t)he->h_length); 342 352 addr.sin_family = AF_INET; 343 353 addr.sin_port = htons(inport); 344 354 345 printf("%s input: host = %s, port = %d%s%s\n", mode == SISNET ? "sisnet" 346 : "socket", 347 inet_ntoa(addr.sin_addr), inport, initfile ? ", initfile = " : "", 348 initfile ? initfile : ""); 349 350 if(connect(gpsfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) 355 printf("%s input: host = %s, port = %d%s%s%s\n", mode == SISNET ? "sisnet" 356 : mode == TCPSOCKET ? "tcp socket" : "udp socket", 357 bindmode ? "127.0.0.1" : inet_ntoa(addr.sin_addr), inport, 358 initfile ? ", initfile = " : "", 359 initfile ? initfile : "", bindmode ? " binding mode" : ""); 360 361 if(bindmode) 362 { 363 if(bind(gpsfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) 364 { 365 fprintf(stderr, "ERROR: can't bind input to port %d\n", inport); 366 exit(1); 367 } 368 } 369 else if(connect(gpsfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) 351 370 { 352 371 fprintf(stderr, "ERROR: can't connect input to %s at port %d\n", … … 484 503 exit(0); 485 504 } 486 printf("connection succes full\n");505 printf("connection successfull\n"); 487 506 send_receive_loop(sock_id, gpsfd, mode == SISNET); 488 507 } … … 723 742 fprintf(stderr, " -H hostname of TCP server (default: %s)\n", SERV_HOST_ADDR); 724 743 fprintf(stderr, " -f initfile send to server\n"); 744 fprintf(stderr, " -B bindmode (bind to incoming UDP stream)\n"); 725 745 fprintf(stderr, " Mode = sisnet:\n"); 726 746 fprintf(stderr, " -P receiver port (default: %d)\n", SISNET_PORT);
Note:
See TracChangeset
for help on using the changeset viewer.