Connecting Tech Pros Worldwide Help | Site Map

Issue with Sopen() and dropping a network connection.

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2005, 07:12 PM
Kim Hamilton
Guest
 
Posts: n/a
Default 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



  #2  
Old July 19th, 2005, 07:13 PM
Thomas Matthews
Guest
 
Posts: n/a
Default 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:
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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.