05-13-2019, 01:50 PM
(This post was last modified: 05-14-2019, 08:26 AM by rlebeau.
Edit Reason: mark code.
)
Yes, I've understood this very clearly.
I'd like to thank you again for this explanation.
Another question:
The remote server sends a very large content-size and starts sending data (realtime quotes requested in subsequent posts).
My app receives these data in the Write method of a TStream descendant.
Each data content is terminated with a CR LF.
When content-length is reached, the component is reconnected as explained by the vendor docs.
I can't do any king of pooling or buffering as data consumption must occur ASAP.
To minimize the problem with TIdHTTP receive buffer, I've wrote the following code:
I can say this resolved my issue, It's working fine, the test program works for many consecutive hours receiving data.
Of course this is a PoC and this code later will be introduced in a very large system that already uses a TIdHTTP to receive data from another vendor server.
My feeling is that I'm writing a very ugly code doing things this way.
I'd like to know if there's any better approach to do this or even if it's possible to write a class to replace the receive buffer (of course, the goal is no buffering).
I'd like to thank you again for this explanation.
Another question:
The remote server sends a very large content-size and starts sending data (realtime quotes requested in subsequent posts).
My app receives these data in the Write method of a TStream descendant.
Each data content is terminated with a CR LF.
When content-length is reached, the component is reconnected as explained by the vendor docs.
I can't do any king of pooling or buffering as data consumption must occur ASAP.
To minimize the problem with TIdHTTP receive buffer, I've wrote the following code:
Code:
void __fastcall TLSConexaoHttp::HTTPConnected(TObject *Sender)
{
TIdHTTP * pHTTP = static_cast<TIdHTTP*>(Sender);
pHTTP->IOHandler->WriteBufferFlush();
pHTTP->IOHandler->RecvBufferSize = 8;
}I can say this resolved my issue, It's working fine, the test program works for many consecutive hours receiving data.
Of course this is a PoC and this code later will be introduced in a very large system that already uses a TIdHTTP to receive data from another vendor server.
My feeling is that I'm writing a very ugly code doing things this way.
I'd like to know if there's any better approach to do this or even if it's possible to write a class to replace the receive buffer (of course, the goal is no buffering).

