Intermittant failure of httpsocket.get

I have code that works, but fails a high percentage of the time. I’m using a local linux / apache machine as a file server.
I’m using httpsocket.get to check the existence of the file and download it if it does exist.
It works, but most of the time it fails. I get a httpsocket.errorcode of -1 after a timeout equal to the seconds set in the .get (5 seconds in this case).
The server is local and I can watch the access log. When it is working I see the request in the accesss log and everything looks great.
When it is not working, no request is registered with Apache.
I can’t find any rhyme or reason why sometimes it works and sometimes it doesn’t. Any ideas where I should look?

// Now check for the existence on Apache
  dim needFile as boolean = false
  f = SpecialFolder.Temporary.Child(partID+".pdf")
  dim myString  as string 
  myString = "http://" + +"/prints/"+ aprintset(pointer,13) + "/" + partID + "/offPrint.pdf"
  if H.Get ( myString, f,5) then
    if h.HTTPStatusCode=200 then
    elseif  h.HTTPStatusCode=404 then
      needFile = True
    end if
    MsgBox( "error checking for files on apache - " + cstr(H.ErrorCode))
  end if

Found the problem right after I posted this.
My error was in the file I was downloading to.
Because I was launching it, it was open in my pdf viewer. When I tried to download it a second time, it could not overwrite the local file which I gave the same name. The result was a timeout and the http request is not made.