Changeset 1091 in ntrip


Ignore:
Timestamp:
Sep 2, 2008, 9:29:33 AM (16 years ago)
Author:
stoecker
Message:

fixed connection failure detection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/rtcm3torinex/rtcm3torinex.c

    r1088 r1091  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.29 2008/07/22 15:15:51 stoecker Exp $
     3  $Id: rtcm3torinex.c,v 1.30 2008/09/01 07:47:15 stoecker Exp $
    44  Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu>
    55
     
    15321532
    15331533#ifndef NO_RTCM3_MAIN
    1534 static char datestr[]     = "$Date: 2008/07/22 15:15:51 $";
     1534static char datestr[]     = "$Date: 2008/09/01 07:47:15 $";
    15351535
    15361536/* The string, which is send as agent in HTTP request */
     
    18871887}
    18881888
     1889#ifndef WINDOWSVERSION
     1890static void WaitMicro(int mic)
     1891{
     1892  struct timeval tv;
     1893  tv.tv_sec = mic/1000000;
     1894  tv.tv_usec = mic%1000000;
     1895#ifdef DEBUG
     1896  fprintf(stderr, "Waiting %d micro seconds\n", mic);
     1897#endif
     1898  select(0, 0, 0, 0, &tv);
     1899}
     1900#else /* WINDOWSVERSION */
     1901void WaitMicro(int mic)
     1902{
     1903   Sleep(mic/1000);
     1904}
     1905#endif /* WINDOWSVERSION */
     1906
    18891907#define ALARMTIME   (2*60)
    18901908
     
    21922210                  if(init)
    21932211                  {
     2212                    int z;
    21942213                    if(u < -30000 && sn > 30000) sn -= 0xFFFF;
    21952214                    if(ssrc != w || ts > v)
     
    21992218                    }
    22002219                    if(u > sn) /* don't show out-of-order packets */
    2201                       fwrite(buf+12, (size_t)i-12, 1, stdout);
     2220                    for(z = 12; z < i && !stop; ++z)
     2221                      HandleByte(&Parser, (unsigned int) buf[z]);
    22022222                  }
    22032223                  sn = u; ts = v; ssrc = w; init = 1;
     
    23242344        while(!stop && (numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) != -1)
    23252345        {
    2326           alarm(ALARMTIME);
     2346          if(numbytes > 0)
     2347            alarm(ALARMTIME);
     2348          else
     2349          {
     2350            WaitMicro(100);
     2351            continue;
     2352          }
    23272353          if(!k)
    23282354          {
     
    23532379              if(i < numbytes-l)
    23542380                chunkymode = 1;
    2355             }
     2381            }
    23562382            else if(numbytes < 12 || strncmp("ICY 200 OK\r\n", buf, 12))
    23572383            {
Note: See TracChangeset for help on using the changeset viewer.