Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: ICS Webserver display an image
| Subject: | Re: ICS Webserver display an image |
| Posted by: | "Bob D." (bo..@demo.it) |
| Date: | Wed, 21 Nov 2007 20:21:41 |
Thank you Remmy. I'm doing something wrong?
procedure TForm1.HttpServerGetDocument(Sender, Client: TObject;
var Flags: THttpGetFlag);
var
MS: TMemoryStream;
begin
MS := TMemoryStream.Create;
MS.LoadFromFile('c:\FixSystem.jpg');
MS.Position := 0;
THttpConnection(Client).DocStream := MS;
Flags := hgSendStream;
MS.Free;
end;
It doesnt load the page and after 1 minute it displays
Internet Explorer cannot display the webpage
Thanks
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:47447026@newsgroups.borland.com...
>
> "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