Extreme slowdown when accessing files over the network through VB when using an XP machine.
Posted on 2003-03-24
One part of my program checks the status of various files on other machines over a corporate network as a means of tracking progress on on a centralized machine. One of the issues that I never was able to resolve when using a Win98 box was having to manually open a connection to each machine (open a folder on each machine even though the folder share passwords were stored). When trying to access files in shared folders it would just come up as unavailable if I tried doing from within the VB program if I had not yet manually opened the shared folder.
Well now with WinXP it no longer does this, however that issue has now been replaced with a much more annoying one. Where before access was instant, it now takes 20-30 seconds to open a connection to any of the other machines (that is it no longer makes me manually open a folder, but now it basically locks up while it waits for 20+ seconds for the network connection to complete and the files to become accessible).
I realize this may not be the best forum to ask this question, since I also experience the slowdown when trying to open a shared folder outside of VB using an XP machine, but I thought perhaps someone might know a more direct way of checking a file across the network than what I'm using which would bypass this slowdown (or ideally something to reduce the lag). While I would like to read data from text files instantly without delay, it would suffice if I could at least know whether a named file exists in a given shared folder. Oddly this delay also crops up if there isn't constant communication as well. That is if a few minutes pass without accessing the shared folder, I incurr the long delay once again on the next attempt at access.
Public Function FileExist(strPath As String) As Boolean
'Check whether a file exists/can be accessed
Dim X As Integer
X = FreeFile
On Error Resume Next
Open strPath For Input As X
If Err = 0 Then
FileExist = True
Else: FileExist = False