Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: Problem Using ftp with winInet
| Subject: | Re: Problem Using ftp with winInet |
| Posted by: | "Joe H" (joedot..@att.net) |
| Date: | 8 Nov 2007 13:12:42 |
Remy Lebeau (TeamB) wrote:
>
> "Joe H" <joedotah@att.net> wrote in message
> news:47335323@newsgroups.borland.com...
>
> > if InternetReadFile(f,pchar(result[ndx]),BlockSize,AmtRead)
>
Thanks, Remy. I had already corrected that and the problem persisted.
Since I posted, I played around with using InternetQueryDataAvailable
and the download then works. It reads extra padding of zero's at the
end of the file, but I have it worked out to only accept the actual
size. For example, it tells me that 8192 bytes of a 17k or so file are
available on the first call. I can download that much either all at
once or in 1k blocks, and then it starts failing if I attempt to read
beyond that. So I have to have the InternetQueryDataAvailable in the
main loop, and keep calling it until all the data is downloaded.
What a crap way to set this function up. Is this Microsoft's doing or
is that something inherent in the ftp protocol?
I'm not sure what I have to do to get the putfile to work but
apparently I have to do something similar when writing the file. I have
to do other things right now but if you have a clue about what to do to
preceed InternetWriteFile, I'd appreciate knowing about that. I'm not
sure how I would use the InternetQueryDataAvailable in that case. Would
it be telling me how much I can write at a time? I'll try that.
The only reasons I'm using the InternetRead and InternetWrite is to
avoid having to use files for these and so that I can show progress
instead of waiting while large blocks transfer with no feedback.
Ftp sucks anyway because there is an initial delay of probably 20 to 30
seconds to make the connection and sometimes it just fails to connect.
I've never seen such problems with ftp transfers using wsftpPro. and
the connections using the http elements of winInet are just about
instant.
Another inconsistency in WinInet. To connect to an http site you have
to put http:// in front of the web name. To connect with ftp, you
cannot put the ftp://. It fails to connect if you do. What the hell is
with that? Or is all this just specific to my web site?