title: How to put a lock on a file in a multi user environment?
body: <p>I have an executable which is hosted on a server and can be launched from several client work stations. The exe needs to read and write to a particular text file that is located on the same server(shared location). Since the exe can be launched from multiple work stations, I need to put a lock on the text file and do some processing and unlock the file so at any time, only one user will be able to access the file. Also, I need to display some message to the user when the file is locked by another user. Once the file is unlocked, it should be available for the other user to lock and do the processing.</p>
  
  <p>Is there anybody who can provide some sample code snippet how to achieve this?
  Thanks a lot for any help.</p>