Index: /trunk/ntripserver/ntripserver.c
===================================================================
--- /trunk/ntripserver/ntripserver.c	(revision 9811)
+++ /trunk/ntripserver/ntripserver.c	(revision 9812)
@@ -1589,30 +1589,36 @@
     }
     else if ((nBufferBytes) && (outmode == UDP)) {
+      int i;
       char rtpbuf[1592];
-      int i;
-      int ct = time(0);
-      udp_tim += (ct - udp_init) * 1000000 / TIME_RESOLUTION;
-      udp_init = ct;
-      rtpbuf[0] = (2 << 6);
-      rtpbuf[1] = 96;
-      rtpbuf[2] = (udp_seq >> 8) & 0xFF;
-      rtpbuf[3] = (udp_seq) & 0xFF;
-      rtpbuf[4] = (udp_tim >> 24) & 0xFF;
-      rtpbuf[5] = (udp_tim >> 16) & 0xFF;
-      rtpbuf[6] = (udp_tim >> 8) & 0xFF;
-      rtpbuf[7] = (udp_tim) & 0xFF;
-      rtpbuf[8] = (rtpssrc >> 24) & 0xFF;
-      rtpbuf[9] = (rtpssrc >> 16) & 0xFF;
-      rtpbuf[10] = (rtpssrc >> 8) & 0xFF;
-      rtpbuf[11] = (rtpssrc) & 0xFF;
-      ++udp_seq;
-      memcpy(rtpbuf + 12, buffer, nBufferBytes);
-      if ((i = send(socket_tcp, rtpbuf, (size_t) nBufferBytes + 12, MSG_DONTWAIT)) != nBufferBytes + 12) {
-        if (errno != EAGAIN) {
-          perror("WARNING: could not send data to Destination caster");
-          return;
-        }
-      } else
-        nBufferBytes = 0;
+      while(nBufferBytes)
+      {
+        int ct = time(0);
+        int s = nBufferBytes;
+        if(s > 1400)
+          s = 1400;
+        udp_tim += (ct - udp_init) * 1000000 / TIME_RESOLUTION;
+        udp_init = ct;
+        rtpbuf[0] = (2 << 6);
+        rtpbuf[1] = 96;
+        rtpbuf[2] = (udp_seq >> 8) & 0xFF;
+        rtpbuf[3] = (udp_seq) & 0xFF;
+        rtpbuf[4] = (udp_tim >> 24) & 0xFF;
+        rtpbuf[5] = (udp_tim >> 16) & 0xFF;
+        rtpbuf[6] = (udp_tim >> 8) & 0xFF;
+        rtpbuf[7] = (udp_tim) & 0xFF;
+        rtpbuf[8] = (rtpssrc >> 24) & 0xFF;
+        rtpbuf[9] = (rtpssrc >> 16) & 0xFF;
+        rtpbuf[10] = (rtpssrc >> 8) & 0xFF;
+        rtpbuf[11] = (rtpssrc) & 0xFF;
+        ++udp_seq;
+        memcpy(rtpbuf + 12, buffer, s);
+        if ((i = send(socket_tcp, rtpbuf, (size_t) s + 12, MSG_DONTWAIT)) != s + 12) {
+          if (errno != EAGAIN) {
+            perror("WARNING: could not send data to Destination caster");
+            return;
+          }
+        } else
+          nBufferBytes -= s;
+      }
       i = recv(socket_tcp, rtpbuf, sizeof(rtpbuf), 0);
       if (i >= 12 && (unsigned char) rtpbuf[0] == (2 << 6)
@@ -1996,5 +2002,5 @@
   fprintf(stderr, "       Note that the program automatically falls back from mode rtsp to mode http and\n");
   fprintf(stderr, "       further to mode ntrip1 if necessary.\n\n");
-  fprintf(stderr, "       -a <DestHost>     Destination caster/server name or address, default: 127.0.0.1,\n");
+  fprintf(stderr, "       -a <DestHost>     Destination caster/server name or address, default: " NTRIP_CASTER ",\n");
   fprintf(stderr, "                         mandatory\n");
   fprintf(stderr, "       -p <DestPort>     Destination caster/server port, default: 2101,\n");
