Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: ICS Webserver display an image
| Subject: | Re: ICS Webserver display an image |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Wed, 21 Nov 2007 09:50:27 |
"Bob D." <bobd@demo.it> wrote in message
news:47444bd6$1@newsgroups.borland.com...
> I have a webserver using ICS and I want to display an image
> without having the image in a file, just in a MemoryStream.
> How can I do this?
In the OnGetDocument event handler, assign the TMemoryStream to the Client's
DocStream property, and then set the handler's Flag parameter to
hgSendStream. For example:
procedure TForm1.HttpServer1GetDocument(Sender: TObject; Client:
TObject; var Flags : THttpGetFlag);
begin
THttpConnection(Client).DocStream := TheMemoryStream;
Flag := hgSendStream;
end;
With that said, don't share a single Stream across multple client
connections, as they will interfer with each other's seeking and reading of
the Stream. Give each request its own Stream instance.
Gambit