Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages
Started by Jo�o Pereira
Wed, 04 Aug 2004 12:15
TServerSocket -> WebPage
Author: Jo�o Pereira
Date: Wed, 04 Aug 2004 12:15
Date: Wed, 04 Aug 2004 12:15
17 lines
1380 bytes
1380 bytes
How can i automatic send a image to a web page. Per example inserting my
remote IP in the address bar of IE and automaticly loads a image that is on
the other side.
I've tryed this code:
void __fastcall TForm1::MyServerClientRead(TObject *Sender,
TCustomWinSocket *Socket)
{
TMemoryStream *MyStream = new TMemoryStream();
MyStream->LoadFromFile("c:\\imagem.jpg");
Socket->SendStream(MyStream);
}
but in IE the image just loads about 90% and i gotta press stop to see the
image. Seems like i got to send the stream size, but how can i do that?
Re: TServerSocket -> WebPage
Author: Remy Lebeau (TeamB)
Date: Wed, 04 Aug 2004 17:16
Date: Wed, 04 Aug 2004 17:16
29 lines
1781 bytes
1781 bytes
"Jo�o Pereira" <joao@pupula.com> wrote in message
news:4110d343$1@newsgroups.borland.com...
> I've tryed this code:
<snip>
That code is nowhere near what web browsers require.
> but in IE the image just loads about 90% and i gotta press
> stop to see the image. Seems like i got to send the stream size,
> but how can i do that?
I strongly suggest you read the HTTP RFCs. They tell you what all is
actually required:
Hypertext Transfer Protocol version 1.0 (HTTP/1.0)
http://www.ietf.org/rfc/rfc1945.txt
Hypertext Transfer Protocol version 1.1 (HTTP/1.1)
http://www.ietf.org/rfc/rfc2616.txt
I should warn you, though - HTTP is not trivial to implement properly. I
suggest you get a pre-made HTTP server component, such as the one from Indy
(http://www.indyproject.org) or ICS (http://www.overbyte.be), and let it do
all the bulk of the work for you.
Gambit
Re: TServerSocket -> WebPage
Author: Colin B Maharaj
Date: Wed, 18 Aug 2004 03:43
Date: Wed, 18 Aug 2004 03:43
26 lines
1778 bytes
1778 bytes
You probably need to disconnect the connection, from the server end,
after you send all the data to the client....
e.g. Socket->Disconnect();
Jo�o Pereira wrote:
> How can i automatic send a image to a web page. Per example inserting my
> remote IP in the address bar of IE and automaticly loads a image that is on
> the other side.
>
> I've tryed this code:
>
> void __fastcall TForm1::MyServerClientRead(TObject *Sender,
> TCustomWinSocket *Socket)
> {
> TMemoryStream *MyStream = new TMemoryStream();
> MyStream->LoadFromFile("c:\\imagem.jpg");
> Socket->SendStream(MyStream);
>
> }
>
> but in IE the image just loads about 90% and i gotta press stop to see the
> image. Seems like i got to send the stream size, but how can i do that?
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads