RTC Forums
April 27, 2024, 09:30:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Downloading files w/o the need of implementing RtcEvents?  (Read 5280 times)
kaju74
Newbie
*
Posts: 25


« on: February 12, 2010, 03:19:20 PM »

Hi...

I love the new & wonderfull "prepare" function to deal with my XMLRpc-Server. Using this, I'm able to write my whole code in
only one method, without the need of implementing some of the RtcEvents (OnDataReceiver, On....).

I wonder if it's possible to use the same technique to retrieve files from a HTTP-Server?

Best regards,
Marc
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 12, 2010, 04:32:31 PM »

You can use the "WaitForCompletion" method to wait for a full response from all requests sent to the Server, but there is currently no way to download complete files from a Server without implementing any events on the Client. So, unfortunately, the answer to your question is no - for the moment. Using RTC SDK 3.51 or older, you can't download files without implementing any RTC events.

But ... I have already been thinking about adding new methods to the TRtcDataRequest component, or adding a new component which would make it possible to prepare a request and direct a response to a TStream or a local file (both specified before sending the request) without implementing any events. I can't give you any promises about when this will happen, but I do plan to do this and release it in one of the upcoming RTC SDK updates.

Best Regards,
Danijel Tkalcec
Logged
kaju74
Newbie
*
Posts: 25


« Reply #2 on: February 12, 2010, 05:18:37 PM »

Hi...

...nice to hear, that you're thinking about that..

The users of my app already have to wait for download completation so, for this case, I don't need any asynchron communication. This app downloads some specific files which have to been handled in different ways. Now, I put some info into the request and handle them using the different events. It would be a lot easier, if I could implement the whole functionality in one method instead of splitting them up to three, four events and sync them...8-))

Best regards,
Marc
Logged
kaju74
Newbie
*
Posts: 25


« Reply #3 on: February 12, 2010, 05:36:31 PM »

BTW:

It would be a cool thing, to simplify some common tasks, e.g. downloading or uploading a file (independant from it's real size)...Many apps
have a simple "check for updates" which would be cool to implement in a snap. Maybe a new component should make sense. Some published
properties to track current download size for example. Mabe a feature to resume an older download or to support multiple download segments
as some download-manager do.

Just a dream 8-)))

Best regards,
Marc

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #4 on: February 12, 2010, 05:46:15 PM »

All the things you have mentioned here can already be achieved by using the RealThinClient SDK through events and I do not want to make too many things automated, because automation also means loss of control and adding one thing might trigger a lot of requests for this-or-that additional missing thing.

What I do plan to do is add a simplified way for sending requests and receiving responses in a blocking way. Nothing more and nothing less. It will basically be a general-purpose implementation of the OnBeginRequest and OnDataReceived events, which will make it possible to direct a Server response into a TStream or a local file and getting a copy of the Response object directly from the rtcDataRequest (or maybe a new "rtcFileRequest" component?) without having to write any events. How you prepare the request and what you want to do with the data received will be up to you.

Best Regards,
Danijel Tkalcec
Logged
kaju74
Newbie
*
Posts: 25


« Reply #5 on: February 12, 2010, 06:04:15 PM »

Hi again.

Okay...I understand...8-) I'm a little bit overhelmed about the possibilities how to add several functions, events, ... to get what I want...I'm not sooo familiar with TCP stuff. So, just for example, I don't know how to read the manual to understand, how to implement a download-mechanism with support for multiple segements or how to resume an older download.

But I think, that's my fault 8-)

Best regards,
Marc
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: February 12, 2010, 06:09:55 PM »

Using multiple connections to download multiple segments at the same time is a bit complicated and requires a but more than general knowledge about TCP/IP, so you will not find that kind of information in documentation.

As for download resuming, this is handled by using the "Bytes" HTTP header (Request['Bytes']) on the Client and the Server to negotiate which part of the file should be sent. This is also something that is handled by your own implementation. For example, the rtcFileProvider unit used by the RTC WebServer handles download resuming, but you will need the apropriate Client implementation to use this from your Delphi client. This is not something the RTC SDK can nor should handle automatically.

In other words, to use the RTC SDK for more advanced things like writing a file download manager or implementing a server and a client which would support file download resuming, you will need to get more familiar with the HTTP protocol and the purpose of HTTP header values.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.025 seconds with 16 queries.