Index: trunk/rtcm3torinex/rtcm3torinex.c
===================================================================
--- trunk/rtcm3torinex/rtcm3torinex.c	(revision 476)
+++ trunk/rtcm3torinex/rtcm3torinex.c	(revision 477)
@@ -1,5 +1,5 @@
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.c,v 1.17 2007/01/23 17:16:39 stoecker Exp $
+  $Id: rtcm3torinex.c,v 1.18 2007/04/11 09:08:39 stoecker Exp $
   Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
 
@@ -51,5 +51,5 @@
 
 /* CVS revision and version */
-static char revisionstr[] = "$Revision: 1.17 $";
+static char revisionstr[] = "$Revision: 1.18 $";
 
 #ifndef COMPILEDATE
@@ -1021,5 +1021,5 @@
 
 #ifndef NO_RTCM3_MAIN
-static char datestr[]     = "$Date: 2007/01/23 17:16:39 $";
+static char datestr[]     = "$Date: 2007/04/11 09:08:39 $";
 
 /* The string, which is send as agent in HTTP request */
@@ -1083,4 +1083,5 @@
   const char *server;
   int         port;
+  int         timeout;
   const char *user;
   const char *password;
@@ -1099,4 +1100,5 @@
 { "password",   required_argument, 0, 'p'},
 { "port",       required_argument, 0, 'r'},
+{ "timeout",    required_argument, 0, 't'},
 { "header",     required_argument, 0, 'f'},
 { "user",       required_argument, 0, 'u'},
@@ -1104,5 +1106,5 @@
 {0,0,0,0}};
 #endif
-#define ARGOPT "-d:hp:r:s:u:f:"
+#define ARGOPT "-d:s:p:r:t:f:u:h"
 
 static const char *geturl(const char *url, struct Args *args)
@@ -1187,4 +1189,5 @@
   args->server = "www.euref-ip.net";
   args->port = 2101;
+  args->timeout = 60;
   args->user = "";
   args->password = "";
@@ -1195,4 +1198,5 @@
   do
   {
+
 #ifdef NO_LONG_OPTS
     switch((getoptr = getopt(argc, argv, ARGOPT)))
@@ -1212,4 +1216,10 @@
         res = 0;
       break;
+    case 't': 
+      args->timeout = strtoul(optarg, &t, 10);
+      if((t && *t) || args->timeout < 0)
+        res = 0;
+      break;
+
     case 1:
       {
@@ -1246,4 +1256,5 @@
     " -p " LONG_OPT("--password   ") "the login password\n"
     " -r " LONG_OPT("--port       ") "the server port number (default 2101)\n"
+    " -t " LONG_OPT("--timeout    ") "timeout in seconds\n"
     " -u " LONG_OPT("--user       ") "the user name\n"
     "or using an URL:\n%s ntrip:mountpoint[/username[:password]][@server[:port]]\n"
@@ -1283,4 +1294,6 @@
   struct RTCM3ParserData Parser;
 
+  struct timeval tv;
+
   setbuf(stdout, 0);
   setbuf(stdin, 0);
@@ -1327,4 +1340,13 @@
       exit(1);
     }
+
+    tv.tv_sec  = args.timeout;
+    tv.tv_usec = 0;
+    if(setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval) ) == -1)
+    {
+      RTCM3Error("Function setsockopt: %s\n", strerror(errno));
+      exit(1);
+    }
+
     their_addr.sin_family = AF_INET;    /* host byte order */
     their_addr.sin_port = htons(args.port);  /* short, network byte order */
