On May 13, 2007, at 05:45, Erik Brännlund wrote:
> Hi!
>
> I'm trying to send a small JPEG- image over TWSocket directly. If I
> send a
> HTML coded page it works but not for an image.
>
> This is what I send.
>
> l.Add('HTTP/1.1 200 OK' + #13#10); // l is TStringList;
> l.Add('Content-Type: image/jpeg' + #13#10);
> l.Add('Content-Length: ' + IntToStr(O.Size) + #13#10#13#10);
> l.SaveToStream(O); //O is TMemoryStream;
> J.SaveToStream(O);//J is a small JPEG (size is ~800 bytes)
> Sock.Send(O.Memory, O,Size);
>
> What am I doing wrong?
You have to specify the Content-Encoding mechanism also, so that the
receiver knows how to interpret the data. The most common way using
MIME is to encode using Base64, then your header would be:
Content-Type: image/jpeg
Content-Encoding: base64
Content-Length: {...whatever...}
{...data...}
dZ.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be