Title: RtcClientRequest.ContentOut problem Post by: Max Terentiev on February 03, 2017, 12:57:41 AM Hi Danijel,
I use RtcMessageClient+RtcDataRequest to upload file to server (RtcMessageServer+RtcDataProvider). I Use RtcDataRequest.OnDataSent like this: Code: procedure TApiUploader.DataSent(Sender: TRtcConnection); And I got exception: "Error! Answer allready sent for this request." because Request.ContentOut is always 0 it's not updated every Write call so I send more data than expected. But this code works well with RtcHttpClient - with Http CountentOut updates as expected ! It's another limitation of RtcMessageClient ? Or probably bug in RTC ? p.s. For file downloading I use similar code on server side: Response.ContentOut is used for file reading. So, it's works with RtcMessageServer ! If Response.ContentOut works on server side I expect Request.ContentOut should works on client side ! Or I missing something ? Title: Re: RtcClientRequest.ContentOut problem Post by: D.Tkalcec (RTC) on February 03, 2017, 05:06:11 PM TRtcMessageClient component's connection provider was missing the required code to increase the "Request.ContentOut" property after every "Write" or "WriteEx" method call. I have fixed this and will be releasing it with the next official RTC SDK update (soon), but you can also apply the fix now in your copy by adding the 2 missing lines in the "rtcMsgCliProv.pas" unit, as shown in this unified diff below:
--- rtcMsgCliProv.pas +++ rtcMsgCliProv.pas @@ -431,7 +431,8 @@ RequestStream.Write(s[0], length(s)); FDataOut:=length(s); - LenToWrite:=LenToWrite-FDataOut; + Dec(LenToWrite,FDataOut); + Request.ContentOut:=Request.ContentOut + FDataOut; try TriggerDataOut; finally @@ -457,7 +458,8 @@ {$ENDIF} FDataOut:=length(s); - LenToWrite:=LenToWrite-FDataOut; + Dec(LenToWrite,FDataOut); + Request.ContentOut:=Request.ContentOut + FDataOut; try TriggerDataOut; finally Best Regards, Danijel Tkalcec Title: Re: RtcClientRequest.ContentOut problem Post by: Max Terentiev on February 04, 2017, 12:01:52 AM Thank you !
Title: Re: RtcClientRequest.ContentOut problem Post by: D.Tkalcec (RTC) on February 04, 2017, 11:32:47 AM You're welcome and thanks for reporting this problem.
This fix is now included in the latest RTC SDK update (v7.75 - just released). Best Regards, Danijel Tkalcec |