RTC Forums
November 24, 2024, 09:27:01 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
Streaming question
Pages: [
1
]
« previous
next »
Print
Author
Topic: Streaming question (Read 4496 times)
jonb2
Newbie
Posts: 36
Streaming question
«
on:
February 06, 2012, 09:00:18 PM »
New at this, so please be patient :-)
I am using RTC client controls (httpclient/datarequest) as an API get/post interface to various web services. I have taken the http client demo and successfully got it working with returning data using just the serveraddr/host/ and .text parameters (no filename needed I think). The data is being shown in the memo, as per the demo. I would now really want to load the returned data into a stream (perhaps).
The returned data is a smorgasboard of Json, XML and plain multiline CSV - depending on which service I am talking to. So there is qute a lot of condtional post-processing. I think that rtcByteStream will be the fastest choice as a universal stream for this. Am I right? If so - please could you supply a code snippet which substitutes the memo for the stream. I can't seem to get my head around it.
In other words, the question is how to move received data into an optimal state for further string processing. Simply, how do I get the returned data into a stream
TIA
Jon
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Streaming question
«
Reply #1 on:
February 06, 2012, 09:12:28 PM »
Since you are using the TRtcDataRequest component, you will get the data as AnsiString when using the "Read" method. This is what you already have working, since you are placing that data into a Memo. If you want to copy that AnsiString (returned from the "Read" method) into a TStream, the "TStringStream" class from Delphi should do the trick. For more information on using the TStringStream class ("Classes.pas" unit in the Delphi RTL), please reffer to Delphi HELP files.
PS. You can wait for "TRtcDataClient(Sender).Response.Done" to return TRUE before you use the "Read" method, then you will get the complete response content in a single AnsiString when using the "Read" method (no need to manually contatenate it).
Best Regards,
Danijel Tkalcec
Logged
jonb2
Newbie
Posts: 36
Re: Streaming question
«
Reply #2 on:
February 07, 2012, 09:08:49 AM »
Thanks D.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...