Kim Hamilton wrote:
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 ?
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.
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
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:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book