When client request a file to server, use OnHTTP2Response event to load the stream response.
TsgcHTTP2Client *oClient = new TsgcHTTP2Client();
oClient->OnHTTP2Response = OnHTTP2ResponseEvent;
oClient->Get("https://http2.golang.org/file/gopher.png");
...
void OnHTTP2ResponseEventEvent(TObject: *Sender; const TsgcHTTP2ConnectionClient *Connection;
const TsgcHTTP2RequestProperty *Request; const TsgcHTTP2ResponseProperty *Response)
{
TFileStream oStream = new TFileStream("file", fmOpenWrite or fmCreate);
try
{
oStream->CopyFrom(Response->Data, Response->Data->Size);
}
__finally
{
oStream.Free;
}
}