Announcement

Collapse
No announcement yet.

Opening a random file on a network drive - Delay when not available.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Opening a random file on a network drive - Delay when not available.

    Hi !

    I often map drives over a network (VPN) or map drives over a DSL
    connection; a problem I often have is when the drive I am connected
    to where a random file resides is not available or the ping response to it is way to long . .

    What usually happens is my software would hang with no error display.
    Is there any solution that could report the drive as unavailable sooner.
    Although I trap the error with a error routine the process
    before the operating system reports none availability is drawn out.
    Is their anyway to trap the none availability of a drive sooner??

    This is how I connect to the drive (sample random file):-

    ON ERROR GOTO ERR_R:
    OPEN"\\10.0.0.99\BACKUP\PROGRAMS\TEST.XXX" FOR RANDOM ACCESS READ WRITE SHARED AS #1 LEN=256
    FIELD#1,256 AS T$
    LSET T$="TSET XXX end"
    PUT#1,1
    GET#1,1
    CLS
    PRINT T$
    CLOSE
    END

    ERR_R:
    IF ERR=75 THEN PRINT”DRIVE DOWN ! ! ! “ RESUME (TO SUB WHICH WILL HANDLE THE ERROR”

    Thanks in Advance

    BASit


    ------------------

  • #2
    Have you taken into account the possibility of the drive having
    to spin up after a power down (as appropriate)?

    If so, the only other thing is some kind of timer function that
    will time-out after a specified period of time and jump your
    program to an error handler. Don't have a clue as to how to
    structure the function.


    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Thanks Mr Bishop,

      *Hehe* ummmmm drive must power up . . I mean like why? these days drives don't power down energy saving is not a big issue any more as long as the rich nations could plunder the resources of the poor; with either war or >>> lets not go there !!

      I have looked at various methods to check if the drive is available (outside the program); however what I was hoping for is some routine or function as you call it that could return a ping response to the program before the drive is open'ed.

      Someone please help . .

      BASit



      ------------------

      Comment


      • #4
        If you want to make sure the drive is available so as not to
        cause a delay within your program, than I might suggest not
        "pinging" it, but perform a DIR reference to it when the program
        starts. You can do this in a BAT file by spedifying it as the
        working directory for when your program starts.

        I don't know what you intend to do if the working drive\directory
        is not available, but then I'm not sure why you want to create a
        random file on a networked drive anyway, since that is probably
        intended to be temporary in nature, and it is not near as efficient
        to write and read file data over a network connection.

        ------------------
        Old Navy Chief, Systems Engineer, Systems Analyst, now semi-retired

        Comment

        Working...
        X