I have probably close to 1,000 users that I want to randomly access the same file every 5 minutes located on a server. For sure at some times there will be multiple connections to the same file. I have the following code, and was wondering if it would cause some file/lock or access issues:
Would it be better to have this file copied to the local machine and then read locally? Or by using this method can multiple users read this file? I wont ever be writing to it.
Thanks
Code:
Dim strLine As String
Dim objStreamReader
Dim i As Integer
'Pass the file path and the file name to the StreamReader constructor.
objStreamReader = New StreamReader("C:\test.txt")
'Read the first line of text.
strLine = objStreamReader.ReadLine
'Continue to read until you reach the end of the file.
Do While Not strLine Is Nothing
i = i + 1
'Write the line to the Console window.
If i = 3 Then ListBox1.Items.Add(strLine) 'Write Line 3
If i = 5 Then ListBox1.Items.Add(strLine) 'Write Line 5
'Read the next line.
strLine = objStreamReader.ReadLine
Loop
'Close the file.
objStreamReader.Close()
Would it be better to have this file copied to the local machine and then read locally? Or by using this method can multiple users read this file? I wont ever be writing to it.
Thanks