RTC Forums
November 10, 2024, 08:49:11 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
>
Header AV
Pages: [
1
]
« previous
next »
Print
Author
Topic: Header AV (Read 4406 times)
dev
Newbie
Posts: 10
Header AV
«
on:
May 25, 2014, 11:32:55 AM »
Hello.
I am doing an exercise to extend the AppClient and AppServer demos with headers.
While there is some success with sending and receiving the header on the server, I am stuck with the following AVs:
First chance exception at $76A2C42D. Exception class Exception with message 'Last header intercepted with new header, before data sent out.'. Process AppClient.exe (10196)
First chance exception at $76A2C42D. Exception class Exception with message 'More Results received than Calls sent.'. Process AppClient.exe (7728)
Hoping someone can show me the right way to overcome this issue.
AppClient:
procedure TForm1.Edit1Change(Sender: TObject);
begin
with RtcClientModule1 do
begin
StartCalls;
try
RtcClient.Request['h1'] := 'Hello World!';
RtcClient.WriteHeader;
// Call the Add function
..
..
finally
// Post all prepared calls
Post; // causes AV
end;
AppServer:
procedure TForm1.RtcDataProvider1CheckRequest(Sender: TRtcConnection);
var Srv:TRtcDataServer absolute Sender;
begin
if Srv.Request.Complete then
showmessage(srv.Request['h1']);
// accept;
end;
Thanks & regards
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Header AV
«
Reply #1 on:
May 25, 2014, 01:52:39 PM »
You are getting exceptions raised by the RTC SDK to warn you, because you are trying to bend the components to do something they were not designed for.
First off, you should NEVER try to use any properties or methods directly on the TRtcHttpClient component outside of events triggered by those components. TRtcDataRequest and TRtcClientModule components have their own public and published properties and methods which were designed for use outside of RTC events, but all the properties and methods on the TRtcHttpClient components may ONLY be used from inside RTC events. Nowhere else.
Secondly, you can NOT simply inject a HTTP header into a request which is supposed to be used for sending remote function calls. When using RTC remote functions through the TRtcClientModule component, the component itself will be creating and preparing a new HTTP header object before sending the request and content body containing remote function calls.
If you want to manually design your own HTTP requests with custom HTTP headers containing structured data, you need to use the TRtcDataRequest component and NOT the TRtcClientModule on the Client side.
Best Regards,
Danijel Tkalcec
Logged
dev
Newbie
Posts: 10
Re: Header AV
«
Reply #2 on:
May 25, 2014, 03:17:14 PM »
I see where I was confusing things. Sticking to just TRtcDataRequest all works well.
Thanks for your help Danijel.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...