0

I have an isapi DLL (made in Delphi) that must return large files (video files). All theses video files are concatenated in one single physical file (data file). So for example if an user request the file #123 then the isapi dll will need to return the bytes in the data file located from offset $xx to offset $yy.

Actually my problem is that it's look like I load in memory all the bytes from offset $xx to offset $yy when i send them via EXTENSION_CONTROL_BLOCK WriteClient

Is their a way to not load in memory all the bytes and return it incrementally as the user client request it ?

actually this is my code :

var Buffer: array[0..8191] of Byte;
AStream.Position := StartOffset;
while AStream.Position < EndOffset do begin
  BytesToSend := AFileStream.Read(Buffer, SizeOf(Buffer));
  MyEXTENSION_CONTROL_BLOCK.WriteClient(ECB.ConnID, @Buffer, DWORD(BytesToSend)
end
zeus
  • 12,173
  • 9
  • 63
  • 184
  • without code it is hard to tell, you should know that by now :) – whosrdaddy Jan 26 '18 at 12:35
  • I just add the code if it's can help you .. – zeus Jan 26 '18 at 12:41
  • Might be some answers here: https://stackoverflow.com/questions/9600856/how-to-deliver-big-files-in-asp-net-response – Dave Nottage Jan 26 '18 at 21:06
  • thanks dave, but i just found that on IIS their is the perfect solution for that: https://msdn.microsoft.com/en-us/library/ms525816(v=vs.90).aspx ... i will update a little the source code of delphi to handle it – zeus Jan 26 '18 at 21:12

1 Answers1

0

Please have a look at this and see if it applies to your case. If it does, you may be helped by calling this once at the start of each response:

ecb.ServerSupportFunction(ecb.ConnID,HSE_REQ_SET_FLUSH_FLAG,pointer(true),nil,nil);

(where ecb is a pointer to the Extension Control Block)

Stijn Sanders
  • 35,982
  • 11
  • 45
  • 67
  • If you would like to see an example, in a [project of mine](https://github.com/stijnsanders/xxm/blob/master/Delphi/isapi/xxmIsapiMain.pas#L442) I call it right before `HSE_REQ_SEND_RESPONSE_HEADER_EX` – Stijn Sanders Jan 26 '18 at 22:16