Closing handle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Schmitz

    #1

    Closing handle

    Hi,

    I've got the following problem: My current project consists of several
    clients and all of them use(read) a file, that is placed on a shared hard
    disk on one of my file servers (windows2k). So, every user that is logged on
    a computer the client software runs on needs access (exclusive) to this file.
    Now, the problem is, that sometimes the users leave the file in an open
    state - and do not close their handle - so no other client can access the
    file any longer.
    That's why I'm looking for a way to close all handles (even of remote
    clients) to a specific file "by violance". Is this possible?

    Thanks
    Peter
  • William DePalo [MVP VC++]

    #2
    Re: Closing handle

    "Peter Schmitz" <PeterSchmitz@d iscussions.micr osoft.com> wrote in message
    news:544606A0-69ED-44EF-B609-4573A0F554A2@mi crosoft.com...[color=blue]
    > I've got the following problem: My current project consists of several
    > clients and all of them use(read) a file, that is placed on a shared hard
    > disk on one of my file servers (windows2k). So, every user that is logged
    > on
    > a computer the client software runs on needs access (exclusive) to this
    > file.
    > Now, the problem is, that sometimes the users leave the file in an open
    > state - and do not close their handle - so no other client can access the
    > file any longer.
    > That's why I'm looking for a way to close all handles (even of remote
    > clients) to a specific file "by violance". Is this possible?[/color]

    How will you ever be able to distinguish the case where a client validly
    maintains a handle to a file for an extended period from one which breaks
    your rules (unspoken here) ?

    Some advice FWIW:

    1) When the operating system appears to get in the way (here by protecting
    handles), think harder about the design
    2) Rather than require the clients to have exclusive access to a file,
    centralize the file updates and have the clients make requests of the common
    updater

    Regards,
    Will


    Comment

    • Niray

      #3
      Re: Closing handle

      Peter, I have had the same problem accessing the file, but i didn't
      have exclusive user rights to the directory. We had the directory
      permissions set for ASP Net Account. It worked for me on closing the
      file handle and any related objects in the finally block.

      William DePalo [MVP VC++] wrote:[color=blue]
      > "Peter Schmitz" <PeterSchmitz@d iscussions.micr osoft.com> wrote in[/color]
      message[color=blue]
      > news:544606A0-69ED-44EF-B609-4573A0F554A2@mi crosoft.com...[color=green]
      > > I've got the following problem: My current project consists of[/color][/color]
      several[color=blue][color=green]
      > > clients and all of them use(read) a file, that is placed on a[/color][/color]
      shared hard[color=blue][color=green]
      > > disk on one of my file servers (windows2k). So, every user that is[/color][/color]
      logged[color=blue][color=green]
      > > on
      > > a computer the client software runs on needs access (exclusive) to[/color][/color]
      this[color=blue][color=green]
      > > file.
      > > Now, the problem is, that sometimes the users leave the file in an[/color][/color]
      open[color=blue][color=green]
      > > state - and do not close their handle - so no other client can[/color][/color]
      access the[color=blue][color=green]
      > > file any longer.
      > > That's why I'm looking for a way to close all handles (even of[/color][/color]
      remote[color=blue][color=green]
      > > clients) to a specific file "by violance". Is this possible?[/color]
      >
      > How will you ever be able to distinguish the case where a client[/color]
      validly[color=blue]
      > maintains a handle to a file for an extended period from one which[/color]
      breaks[color=blue]
      > your rules (unspoken here) ?
      >
      > Some advice FWIW:
      >
      > 1) When the operating system appears to get in the way (here by[/color]
      protecting[color=blue]
      > handles), think harder about the design
      > 2) Rather than require the clients to have exclusive access to a[/color]
      file,[color=blue]
      > centralize the file updates and have the clients make requests of the[/color]
      common[color=blue]
      > updater
      >
      > Regards,
      > Will[/color]

      Comment

      Working...