Help needed Downloading files with VB6

mAdD INDIAN

Diamond Member
Oct 11, 1999
7,804
1
0
Ok here's the deal...I have a application in VB.NET that constantly updates a website made in VB.net as well. That works fine. Also the website also writes that data to a text file every update.

Now I have another VB6 application that at a set interval downloads the aforementioned txt file to the local computer. It uses the Internet Connection control that's part of VB6.

Now here's the problem, when I'm running the VB6 application to dnload the text file, it somehow causes the website to crash, which stops the uploading application from uploading data. I can't figure out why.

And if I load up that textfile in a browser and hit refresh continously, the site doesn't crash. It only crashes if my downloading application is running.

Here's my code in teh VB6 downloading application that pertains to the actual downloading part.
Dim d() As Byte

inet.URL = txtURL.Text

d() = inet.OpenURL(inet.URL, icByte)

Open "C:\gpsCoord.txt" For Append As #1
Write #1, d()
Close #1

Thanks.
 

mAdD INDIAN

Diamond Member
Oct 11, 1999
7,804
1
0
bump! and an update.

So I fixed the crashing problem by putting in a "Try ....Catch" in the server-side code that writes data to the file. And the exception I'm getting is relating to file being used by another process.
System.IO.IOException: The process cannot access the file ""c:\inetpub\wwwroot\its\gpsData.txt"" because it is being used by another process.
at Microsoft.VisualBasic.FileSystem.FileOpen(Int32 FileNumber, String FileName, OpenMode Mode, OpenAccess Access, OpenShare Share, Int32 RecordLength)
at ITS.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\ITS\write.aspx.vb:line 43"


However I don't see how that is possible, shouldn't the file be locked by the server-side app when it writes to it? When my downloader program downloads the file, even if that file is being written to at the same time, it shouldn't cause a problem since hte file would be locked by the web server anyway

Here's the code that writes the data to the file: