RTC Forums
November 24, 2024, 05:09: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
>
Json question
Pages: [
1
]
« previous
next »
Print
Author
Topic: Json question (Read 4503 times)
JeremyK
Newbie
Posts: 5
Json question
«
on:
May 22, 2013, 06:19:34 PM »
I'm using the rtcHttpclient / data request to get various things from a web server using JSON. So far, they've been simple so have worked perfectly. Now I need to call something that is returning a PDF document, and it's base64 encoded as well. Anyway, I do this when the data is received:
with TRtcDataClient(Sender) do
begin
{ We do not expect a long response,
so we can wait for the response to be Done before reading it. }
if Response.Done then
begin
{ We can use "Read" here to get the complete content sent from the Server
if we expect the Server to send a short content. If the Server is expected
to send a long response, you should use Read before Response.Done and
write the read content to a file as it arrives to avoid flooding your memory. }
s:=Sender.Read;
when reading after downloading the pdf, s is empty, so I suspect the comment above are a clue but I'm unsure the "right" way to handle this as it arrives.
Also, any suggestions as to the best option to decode the base 64?
Thanks
Jeremy
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Json question
«
Reply #1 on:
May 22, 2013, 07:24:40 PM »
What do you mean by "reading after downloading the PDF"? If you have already use the Sender.Read or the Sender.ReadEx method to read the response content, then you have cleared the response buffer.
Also ... you have mentioned JSON, but I don't see any JSON-related code in your example. Can you post more of the code you are using, so I can see what you are doing, and explain what is it you are trying to do?
Best Regards,
Danijel Tkalcec
Logged
JeremyK
Newbie
Posts: 5
Re: Json question
«
Reply #2 on:
June 02, 2013, 02:17:27 PM »
Sorry for being unclear, I meant downloading the data from the server (which contains the PDF). I simply meant at the point of the last line of the bit of code, s was empty (it should have been about 0.5MB). The JSON bit was after this.
Anyhow, I updated to the latest RTC SDK, and looked at your sample about file downloads, so I'm getting it in chunks now and it works as expected.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...