Index: trunk/ntripclient/makefile
===================================================================
--- trunk/ntripclient/makefile	(revision 580)
+++ trunk/ntripclient/makefile	(revision 595)
@@ -1,12 +1,17 @@
-# $Id: makefile,v 1.3 2007/08/30 07:38:24 stoecker Exp $
+# $Id: makefile,v 1.4 2007/10/05 15:32:13 stuerze Exp $
 # probably works not with all compilers. Thought this should be easy
 # fixable. There is nothing special at this source.
 
+ifdef windir
+OPTS = -Wall -W -O3 -DWINDOWSVERSION -lwsock32
+else
+OPTS = -Wall -W -O3 
+endif
+
 ntripclient: ntripclient.c
-	$(CC) -Wall -W -O3 $? -o $@
-
+	$(CC) $(OPTS) $? -o $@
 
 clean:
-	$(RM) -f ntripclient core*
+	$(RM) ntripclient core*
 
 
Index: trunk/ntripclient/ntripclient.c
===================================================================
--- trunk/ntripclient/ntripclient.c	(revision 580)
+++ trunk/ntripclient/ntripclient.c	(revision 595)
@@ -1,5 +1,5 @@
 /*
   Easy example NTRIP client for POSIX.
-  $Id: ntripclient.c,v 1.35 2007/10/26 14:56:47 stuerze Exp $
+  $Id: ntripclient.c,v 1.36 2007/11/20 12:54:05 stoecker Exp $
   Copyright (C) 2003-2005 by Dirk Stoecker <soft@dstoecker.de>
     
@@ -57,6 +57,6 @@
 
 /* CVS revision and version */
-static char revisionstr[] = "$Revision: 1.35 $";
-static char datestr[]     = "$Date: 2007/10/26 14:56:47 $";
+static char revisionstr[] = "$Revision: 1.36 $";
+static char datestr[]     = "$Date: 2007/11/20 12:54:05 $";
 
 enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END };
@@ -74,4 +74,7 @@
   int         bitrate;
   int         mode;
+
+  int         udpport;
+  int         initudp;
 };
 
@@ -83,6 +86,8 @@
 static struct option opts[] = {
 { "bitrate",    no_argument,       0, 'b'},
-{ "data",       required_argument, 0, 'd'},
+{ "data",       required_argument, 0, 'd'}, /* compatibility */
 { "mountpoint", required_argument, 0, 'm'},
+{ "initudp",    no_argument,       0, 'I'},
+{ "udpport",    required_argument, 0, 'P'},
 { "server",     required_argument, 0, 's'},
 { "password",   required_argument, 0, 'p'},
@@ -96,5 +101,5 @@
 {0,0,0,0}};
 #endif
-#define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M:"
+#define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M:IP:"
 
 int stop = 0;
@@ -293,4 +298,6 @@
   args->proxyport = "2101";
   args->mode = AUTO;
+  args->initudp = 0;
+  args->udpport = 0;
   help = 0;
 
@@ -308,9 +315,11 @@
     case 'd':
     case 'm':
-       if(optarg && *optarg == '?') 
-         args->data = encodeurl(optarg);
-       else 
-         args->data = optarg; 
-     break;
+      if(optarg && *optarg == '?') 
+        args->data = encodeurl(optarg);
+      else 
+        args->data = optarg; 
+      break;
+    case 'I': args->initudp = 1; break;
+    case 'P': args->udpport = strtol(optarg, 0, 10); break;
     case 'n': args->nmea = optarg; break;
     case 'b': args->bitrate = 1; break;
@@ -552,6 +561,6 @@
         /* fill structure with local address information for UDP */
         memset(&local, 0, sizeof(local));
-        local.sin_family = AF_INET;  	
-        local.sin_port = htons(0);
+        local.sin_family = AF_INET;
+        local.sin_port = htons(args.udpport);
         local.sin_addr.s_addr = htonl(INADDR_ANY); 
         len = sizeof(local);
@@ -670,4 +679,34 @@
                 exit(1);
               }
+            }
+            if(args.initudp)
+            {
+              printf("Sending initial UDP packet\n");
+              struct sockaddr_in casterRTP;
+              char rtpbuffer[12];
+              int i;
+              rtpbuffer[0] = (2<<6);
+              /* padding, extension, csrc are empty */
+              rtpbuffer[1] = 96;
+              /* marker is empty */
+              rtpbuffer[2] = 0;
+              rtpbuffer[3] = 0;
+              rtpbuffer[4] = 0;
+              rtpbuffer[5] = 0;
+              rtpbuffer[6] = 0;
+              rtpbuffer[7] = 0;
+              rtpbuffer[8] = 0;
+              rtpbuffer[9] = 0;
+              rtpbuffer[10] = 0;
+              rtpbuffer[11] = 0;
+              /* fill structure with caster address information for UDP */
+              memset(&casterRTP, 0, sizeof(casterRTP));
+              casterRTP.sin_family = AF_INET;
+              casterRTP.sin_port   = htons(((uint16_t)serverport));
+              casterRTP.sin_addr   = *((struct in_addr *)he->h_addr);
+
+              if((i = sendto(sockudp, rtpbuffer, 12, 0,
+              (struct sockaddr *) &casterRTP, sizeof(casterRTP))) != 12)
+                perror("WARNING: could not send initial UDP packet");
             }
 
