Thread: Files on network drives

  1. #1
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297

    Files on network drives

    We have an interesting problem on a server product we have built. A client who has the hosted files on a machine SEPARATE from the server has some network hiccups every now and then. If this happens while the file is reading, we hang on the read. This is a tragedy because it's a server and it brings down the server basically.

    Using the older functions such as _fread(), _fopen() etc.

    We thought of bringing the file local while we are using it but the problem could still happen when we're copying. Any ideas?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Difficult, not much info.

    Put the read in a seperate thread and run a timeout against it in your main thread. If it hangs, (i.e. doesn't finish by the expected time), kill the thread then start another.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Yes I suppose that could work. Anyone have any experience with this sort of problem? Will killing the thread as adrianxw said while reading across the network cause problems with windows networking?

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    From my experience here, we have very few professional programmers here in comparison to the number of beginners. You might want to bring your question to a newsgroup such as comp.lang.c++ or comp.lang.c++.moderated (or the c forms if the code is written in c).

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I guess you're right but I always assumed that there were a few pros mixed in. Yeah, I've heard beginners answer questions that they clearly know nothing about but it's the most active programming board I've found so far. (my company does not have a newsgroup server available to me while I'm at work)

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>>
    Will killing the thread as adrianxw said while reading across the network cause problems with windows networking?
    <<<

    Not if it is handled properly. The application I worked on was receiving files via a wireless network from buses. The network connection was established once the bus picked up the base station signal and the various transfer protocols began. Trouble is, the bus driver could decide to drive out whenever he felt he was ready, regardless of the state of the transfer process.

    I had each transfer session running in it's own thread with a central controller thread timing out sessions which seemed to have died.

    There were a few hoops to jump through, but it worked like a charm in the end, (and remember, this was a dark basement, i.e. unattended operation - had to run by itself for months at a time).

    Yes. It can be done.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Deployment and DLL/OCX Files?
    By dfghjk in forum C++ Programming
    Replies: 5
    Last Post: 06-16-2008, 02:47 AM
  2. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  3. Copy files across a network
    By LiteIce in forum C# Programming
    Replies: 4
    Last Post: 10-23-2007, 06:32 AM
  4. Help with loading files into rich text box
    By blueparukia in forum C# Programming
    Replies: 3
    Last Post: 10-19-2007, 12:59 AM
  5. Need help with easy Network setup
    By the dead tree in forum Tech Board
    Replies: 9
    Last Post: 04-08-2005, 07:44 PM