set timeout for HTTP transfers? - Protocols

This is a discussion on set timeout for HTTP transfers? - Protocols ; I have a Kermit data collection script that, among other things, retrieves a file via HTTP. I am having trouble with the HTTP GET command failing with a timeout every once in a while. The data I'm getting from the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: set timeout for HTTP transfers?

  1. set timeout for HTTP transfers?

    I have a Kermit data collection script that, among other things,
    retrieves a file via HTTP. I am having trouble with the HTTP GET
    command failing with a timeout every once in a while.

    The data I'm getting from the HTTP server isn't critical and so I'd
    like to set a short timeout on the HTTP GET operation so my whole data
    collection operation doesn't get held up waiting.

    How does one set the timeout for the HTTP GET operation?

    Thanks.


  2. Re: set timeout for HTTP transfers?

    On 2005-10-17, tomviolin wrote:
    : I have a Kermit data collection script that, among other things,
    : retrieves a file via HTTP. I am having trouble with the HTTP GET
    : command failing with a timeout every once in a while.
    :
    : The data I'm getting from the HTTP server isn't critical and so I'd
    : like to set a short timeout on the HTTP GET operation so my whole data
    : collection operation doesn't get held up waiting.
    :
    : How does one set the timeout for the HTTP GET operation?
    :
    Right now, there's no way. Ditto for FTP, which has also been mentioned
    several times in this connection. It's easy enough (if rather tedious)
    to add alarm()/signal()/setjmp()/longjmp() for Unix, but it's not
    portable to the non-Unix platforms where the C-Kermit code must also run.
    Unlike most other non-portable constructions, the Unix alarm mechanism is
    structural. And it has to be added to each and every place where we are
    doing network i/o for HTTP (or FTP). In the case of HTTP, this would be
    in ckcnet.c, routines http_connect(), http_open(), http_close(), http_inc(),
    http_ttol(), http_get(), http_head(), etc etc, a big mess. Similarly for
    FTP. It's not impossible but it's a lot of work and a lot of risk for
    not a lot of gain compared with some other items on the to-do list.

    Another approach might be to add a generalized timer and trap feature to
    the Kermit command language, and then users could put timeouts around
    anything they wanted:

    set timer 5
    http /array:&a get http://www.blah.com/index.html
    .http_status := \v(status)
    clear timer
    if (\m(http_status)) ...

    The problem there is, how does Kermit know what was going on that needs
    to be cleaned up if the timer goes off? Open connections and whatnot.
    Maybe it doesn't matter, maybe it's worth looking into.

    - Frank

  3. Re: set timeout for HTTP transfers?

    Thanks for the detailed reply. What I'll probably do is run another
    process in parallel to get the HTTP data and record the result in a
    file, and then the Kermit script will just read it from the file. That
    way if the HTTP GET blocks, the other script will simply be collecting
    the most recently read data again, which is better than having the
    whole script hang.

    In case anyone is curious, I'm collecting atmospheric CO2 readings
    locally and grabbing weather data from another site to store in the
    same data record. If the weather data is delayed slightly it's no big
    deal, but the CO2 data, which is the whole point of the study, needs to
    be recorded several times a minute without fail.

    I'm still not quite sure why the HTTP GET is failing, I'm grabbing it
    from another server in the same building. But that's another whole
    issue I'll have to resolve later.


+ Reply to Thread