BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is it possible to transfer file via HTTP?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Christopher
Guest





PostPosted: Sat Sep 03, 2005 2:26 am    Post subject: Is it possible to transfer file via HTTP? Reply with quote



Hi
Is there a way on how to transfer file using HTTP rather than FTP? If yes,
how? Which is a better and more efficient method HTTP or FTP? Which uses
less resources on the server?

Please advice.

Thanks
Chris


Back to top
Francois PIETTE [ICS - Mi
Guest





PostPosted: Sat Sep 03, 2005 7:29 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote



Quote:
Is there a way on how to transfer file using HTTP rather than FTP? If yes,
how?

Yes, easy. Simply use a HTTP client component such as Indy or ICS.
Using ICS ([url]http://www.overbyte.be)[/url], the code looks like this:

HttpCli1.URL := 'http://www.yourserver.com/files/myfile.zip';
HttpCli1.RcvdStream := TFileStream.Create('myfile.zip', fmCreate);
HttpCli1.Get;
HttpCli1..RcvdStream.Free;
if HttpCli1.StatusCode <> 200 then
ShowMessage('Failed ' + HttpCli1.ReasonPhrase)
else
ShowMessage('Done');


Quote:
Which is a better and more efficient method HTTP or FTP? Which uses less
resources on the server?

There is basically not much difference. Both use a TCP stream to transfert
data. Performance and load merely depends on a particular server
implementation.

HTTP is more proxy/firewall friendly.

Note that ICS not only has client components, but has also server components
for both HTTP and FTP.
ICS is freeware. Full source code and lot of sample from
http://www.overbyte.be

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be




Back to top
Ben Hochstrasser
Guest





PostPosted: Sat Sep 03, 2005 7:33 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote



Christopher wrote:

Quote:
Is there a way on how to transfer file using HTTP rather than FTP?

Of course it is. I use it every time I download a file from somewhere.

Quote:
If yes, how?

You need a http server, of course (instead of an FTP server).

Quote:
Which is a better and more efficient method HTTP or FTP?

HTTP is more firewall-friendly as it uses only one port. The transfer speed
is roughly the same, ie it is determined by line speed, not CPU

Quote:
Which uses less resources on the server?

I don't think there's a relevant or measurable difference, provided you
pick the files directly off the file system (and not out of a database).

--
Ben

Back to top
Christopher
Guest





PostPosted: Sat Sep 03, 2005 12:31 pm    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Hi Ben
Actually, i will be having 600 clients running 24 hrs a day. I will have a
program to invoke the clients to download the file from the server.
I have actually done that using FTP method. The result is that some of the
clients will not have the files and some would have but not the actual size
when all 600 clients connect to the server at the same time.
Would i have the same problem with HTTP file transfer?
My colleague told me that using HTTP would be less constraint on the server
as compared to FTP because FTP requires the use of kernel when the user logs
in and logs out. However does using HTTP requires logging in and out?

thanks
chris

"Ben Hochstrasser" <bhoc@tiscali123^H^H^H.ch> wrote

Quote:
Christopher wrote:

Is there a way on how to transfer file using HTTP rather than FTP?

Of course it is. I use it every time I download a file from somewhere.

If yes, how?

You need a http server, of course (instead of an FTP server).

Which is a better and more efficient method HTTP or FTP?

HTTP is more firewall-friendly as it uses only one port. The transfer
speed
is roughly the same, ie it is determined by line speed, not CPU

Which uses less resources on the server?

I don't think there's a relevant or measurable difference, provided you
pick the files directly off the file system (and not out of a database).

--
Ben



Back to top
Ben Hochstrasser
Guest





PostPosted: Sat Sep 03, 2005 2:43 pm    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Christopher wrote:

Quote:
Actually, i will be having 600 clients running 24 hrs a day. I will
have a program to invoke the clients to download the file from the
server. I have actually done that using FTP method. The result is that
some of the clients will not have the files and some would have but
not the actual size when all 600 clients connect to the server at the
same time. Would i have the same problem with HTTP file transfer?

A properly implemented HTTP server causes no less and no more load than a
properly implemented FTP server. What FTP server are you using? (I am using
BRS WebWeaver for both FTP and HTTP on my personal box)

Quote:
My colleague told me that using HTTP would be less constraint on the
server as compared to FTP because FTP requires the use of kernel when
the user logs in and logs out.

It all depends where the server (ftp or http) checks the credentials
against. Flat File? SQL DB? Active Directory? LanManager?
The only thing where FTP is "heavier" is that it has to build up a return
connection to the client (hence the "firewall unfriendliness"). With HTTP,
the connection is already there. That surely saves some overhead.

Quote:
However does using HTTP requires logging in and out?

I'd certainly password-protect the site in question. It's not necessary
though.

In order to guarantee data integrity I warmly recommend to supply a
checksum (md5sum comes to mind) for each file to be downloaded. This way
the client can check the integrity and re-download if necessary.

My personal advice: Don't waste too much time on the server. Waste some
thoughts on the robustness of the clients.

--
Ben

Back to top
Francois PIETTE [ICS - Mi
Guest





PostPosted: Sat Sep 03, 2005 4:58 pm    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Quote:
Actually, i will be having 600 clients running 24 hrs a day. I will have a
program to invoke the clients to download the file from the server.

No problem with HTTP. It will even impose less load on the server since HTTP
use only one socket per client while FTP use two.

Quote:
I have actually done that using FTP method. The result is that some of the
clients will not have the files and some would have but not the actual
size when all 600 clients connect to the server at the same time.

You have a bug somewhere then. What are you using as server and as client ?

Quote:
Would i have the same problem with HTTP file transfer?

Defenitely not. btw: You should not have it neither with FTP !

Quote:
My colleague told me that using HTTP would be less constraint on the
server as compared to FTP because FTP requires the use of kernel when the
user logs in and logs out. However does using HTTP requires logging in and
out?

That's a wrong assumption. HTTP login is not mandatory and may or may not
use more CPU that FTP (several authentification methods are supported by
HTTP).

--

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be




Back to top
Christopher
Guest





PostPosted: Sun Sep 04, 2005 12:40 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Hi Ben

Quote:
A properly implemented HTTP server causes no less and no more load than a
properly implemented FTP server. What FTP server are you using? (I am
using
BRS WebWeaver for both FTP and HTTP on my personal box)

I was using the Microsoft FTP Server on Windows 2000 Server. It seems that
it cannot handle many simultaneous connection. What good HTTP would u
recommend for linux? Apache?

Quote:

In order to guarantee data integrity I warmly recommend to supply a
checksum (md5sum comes to mind) for each file to be downloaded. This way
the client can check the integrity and re-download if necessary.

How do u perform a checksum? When i was using FTP, i have to get the file
size of the file first before downloading. After downloaded the file, it
will check the file size again. Could u explain in detail how to do a
checksum?

Thanks
Chris



Back to top
Ben Hochstrasser
Guest





PostPosted: Sun Sep 04, 2005 8:38 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Christopher wrote:

Quote:
I was using the Microsoft FTP Server on Windows 2000 Server. It seems
that it cannot handle many simultaneous connection. What good HTTP
would u recommend for linux? Apache?

As I said, I am using BRS WebWeaver (free). Dunno about how many
connections it'd handle. Apache certainly isn't a bad choice either. You
could as well use the IIS that comes with Win2000, but make sure you
security-patch and tune it.

Quote:
In order to guarantee data integrity I warmly recommend to supply a
checksum (md5sum comes to mind) for each file to be downloaded. This
way the client can check the integrity and re-download if necessary.

How do u perform a checksum? When i was using FTP, i have to get the
file size of the file first before downloading. After downloaded the
file, it will check the file size again. Could u explain in detail how
to do a checksum?

I recommend the widespread md5sum algorithm. There are Delphi
implementations, there are GNU ports of it etc. Alternatively you can use
CRC-32, again google for a delphi implementation of it.

--
Ben

Back to top
Christopher
Guest





PostPosted: Tue Sep 06, 2005 2:02 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Hi all
I managed to use the idHTTP component to get the file and to save it to a
location. Is it possible to monitor the progress of download?
Is it possible to get the file size before download?

thanks
chris

"Francois PIETTE [ICS - MidWare]" <francois.piette (AT) overbyte (DOT) be> wrote in
message news:4319d73c (AT) newsgroups (DOT) borland.com...
Quote:
Actually, i will be having 600 clients running 24 hrs a day. I will have
a program to invoke the clients to download the file from the server.

No problem with HTTP. It will even impose less load on the server since
HTTP use only one socket per client while FTP use two.

I have actually done that using FTP method. The result is that some of
the clients will not have the files and some would have but not the
actual size when all 600 clients connect to the server at the same time.

You have a bug somewhere then. What are you using as server and as client
?

Would i have the same problem with HTTP file transfer?

Defenitely not. btw: You should not have it neither with FTP !

My colleague told me that using HTTP would be less constraint on the
server as compared to FTP because FTP requires the use of kernel when the
user logs in and logs out. However does using HTTP requires logging in
and out?

That's a wrong assumption. HTTP login is not mandatory and may or may not
use more CPU that FTP (several authentification methods are supported by
HTTP).

--

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be






Back to top
Francois Malan
Guest





PostPosted: Tue Sep 06, 2005 7:43 am    Post subject: Re: Is it possible to transfer file via HTTP? Reply with quote

Christopher wrote:

Quote:
Hi all
I managed to use the idHTTP component to get the file and to save it
to a location. Is it possible to monitor the progress of download?
Is it possible to get the file size before download?



Read the HTTP headers first.

Var HTTP : IdHTTP;

.....


HTTP.Head( URL );

// some error checking
if (HTTP.ResponseCode <> 200) then begin
if (HTTP.ResponseCode >= 500) then Result := dlrServerError
else if (HTTP.ResponseCode >= 400) then Result := dlrFileNotFound;
end;

Now the size of the file is in the property

HTTP.Response.ContentLength


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.