Changeset 477 in ntrip


Ignore:
Timestamp:
Aug 6, 2007, 9:42:25 AM (17 years ago)
Author:
stoecker
Message:

added timeout patch supplied by Kirill Palamartchouk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/rtcm3torinex/rtcm3torinex.c

    r439 r477  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.17 2007/01/23 17:16:39 stoecker Exp $
     3  $Id: rtcm3torinex.c,v 1.18 2007/04/11 09:08:39 stoecker Exp $
    44  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
    55
     
    5151
    5252/* CVS revision and version */
    53 static char revisionstr[] = "$Revision: 1.17 $";
     53static char revisionstr[] = "$Revision: 1.18 $";
    5454
    5555#ifndef COMPILEDATE
     
    10211021
    10221022#ifndef NO_RTCM3_MAIN
    1023 static char datestr[]     = "$Date: 2007/01/23 17:16:39 $";
     1023static char datestr[]     = "$Date: 2007/04/11 09:08:39 $";
    10241024
    10251025/* The string, which is send as agent in HTTP request */
     
    10831083  const char *server;
    10841084  int         port;
     1085  int         timeout;
    10851086  const char *user;
    10861087  const char *password;
     
    10991100{ "password",   required_argument, 0, 'p'},
    11001101{ "port",       required_argument, 0, 'r'},
     1102{ "timeout",    required_argument, 0, 't'},
    11011103{ "header",     required_argument, 0, 'f'},
    11021104{ "user",       required_argument, 0, 'u'},
     
    11041106{0,0,0,0}};
    11051107#endif
    1106 #define ARGOPT "-d:hp:r:s:u:f:"
     1108#define ARGOPT "-d:s:p:r:t:f:u:h"
    11071109
    11081110static const char *geturl(const char *url, struct Args *args)
     
    11871189  args->server = "www.euref-ip.net";
    11881190  args->port = 2101;
     1191  args->timeout = 60;
    11891192  args->user = "";
    11901193  args->password = "";
     
    11951198  do
    11961199  {
     1200
    11971201#ifdef NO_LONG_OPTS
    11981202    switch((getoptr = getopt(argc, argv, ARGOPT)))
     
    12121216        res = 0;
    12131217      break;
     1218    case 't':
     1219      args->timeout = strtoul(optarg, &t, 10);
     1220      if((t && *t) || args->timeout < 0)
     1221        res = 0;
     1222      break;
     1223
    12141224    case 1:
    12151225      {
     
    12461256    " -p " LONG_OPT("--password   ") "the login password\n"
    12471257    " -r " LONG_OPT("--port       ") "the server port number (default 2101)\n"
     1258    " -t " LONG_OPT("--timeout    ") "timeout in seconds\n"
    12481259    " -u " LONG_OPT("--user       ") "the user name\n"
    12491260    "or using an URL:\n%s ntrip:mountpoint[/username[:password]][@server[:port]]\n"
     
    12831294  struct RTCM3ParserData Parser;
    12841295
     1296  struct timeval tv;
     1297
    12851298  setbuf(stdout, 0);
    12861299  setbuf(stdin, 0);
     
    13271340      exit(1);
    13281341    }
     1342
     1343    tv.tv_sec  = args.timeout;
     1344    tv.tv_usec = 0;
     1345    if(setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval) ) == -1)
     1346    {
     1347      RTCM3Error("Function setsockopt: %s\n", strerror(errno));
     1348      exit(1);
     1349    }
     1350
    13291351    their_addr.sin_family = AF_INET;    /* host byte order */
    13301352    their_addr.sin_port = htons(args.port);  /* short, network byte order */
Note: See TracChangeset for help on using the changeset viewer.