Issue with Sopen() and dropping a network connection.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kim Hamilton

    Issue with Sopen() and dropping a network connection.

    Hello,
    I'm using a C++ program to write out a file using sopen(). The file is
    pointed to a network drive. Some times the network goes down, and the file
    errors out. Is there
    any way to spool the file locally, and when the network returns, rewrite the
    file out
    to the network ? I can probably write some code to do all of that, but
    didn't know
    if there were any API calls, say setting to output file as a print spool
    type.
    Any ideas would be helpful.

    K.Hamilton


  • Thomas Matthews

    #2
    Re: Issue with Sopen() and dropping a network connection.

    Kim Hamilton wrote:
    [color=blue]
    > Hello,
    > I'm using a C++ program to write out a file using sopen(). The file is
    > pointed to a network drive. Some times the network goes down, and the file
    > errors out.
    >
    > Is there any way to spool the file locally, and when the network returns,
    > rewrite the file out to the network ?[/color]

    Most likely, yes. You will have to investigate all the networking
    features that your platform provides. Networking is not part of the
    _standard_ C++ language, so not discussed here.

    [color=blue]
    > I can probably write some code to do all of that, but
    > didn't know if there were any API calls, say setting
    > to output file as a print spool type.
    > Any ideas would be helpful.
    >
    > K.Hamilton[/color]

    You need to set up a "spool" or queue and also detect when the
    network is "up" and when it is "down". If the network is up,
    the service routine (or spooler) would send out a packet
    from the current file. If the transmission was successful,
    it would send out the next file. The service routine would
    perform an infinite retry on the network.

    Look at your platform specific "sopen" function for a
    time-out parameter. Try setting it to the maximum.

    --
    Thomas Matthews

    C++ newsgroup welcome message:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    Working...