Article View: borland.public.cppbuilder.internet.socket
Article #902Sending BMP over Indy 9
From: Skaarak
Date: Thu, 23 Aug 2007 16:58
Date: Thu, 23 Aug 2007 16:58
44 lines
2435 bytes
2435 bytes
BDS 2006, Indy 9
I have a TCP Server & Client that connect and talk with each other.
I'm trying to send a BMP from one to the other, but I seem to
be having issues and I was wondering if anyone had any pointers.
So the client seems to connect, and get information over the stream,
but the image that comes across looks like a small box with verticle
lines (like at the end of TV programming at night).
My guess is I'm not quite writing or reading the stream right, but
my experience in this is limited.
Thanks for the help.
-Cory
ps. I did try just copying to a stream and then reading it back from
the stream (same program) and that worked, so I'm assuimg the
data being sent is valid.
----------------------------
SERVER ----------------------------------------------
(In Constructor) sendbmp = new Graphics::TBitmap;
void __fastcall TSDIAppForm::IdTCPServer1Execute(TIdPeerThread *AThread) {
if (AThread->Connection->Connected()) {
TMemoryStream *ms;
ms = new TMemoryStream ();
sendbmp->SaveToStream(ms);
AThread->Connection->WriteStream(ms, true, true, ms->Size);
delete (ms);
}
}
--------------------------
CLIENT ------------------------------------------------
void __fastcall TSDIAppForm::Button3Click(TObject *Sender)
{
TMemoryStream *ms;
ms = new TMemoryStream;
IdTCPClient1->ReadStream(ms, -1, false);
sentbmp->LoadFromStream(ms);
delete ms;
}
Technical Details
Message-ID:
<46cdbcc9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,76a7f9651a366cc8,start X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Skaarak" <skaarak@NOakamailSPAM.com> Newsgroups: borland.public.cppbuilder.internet.socket Subject: Sending BMP over Indy 9 Date: Thu, 23 Aug 2007 10:58:50 -0600 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 NNTP-Posting-Host: 63.231.79.30 Message-ID: <46cdbcc9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1187888329 63.231.79.30 (23 Aug 2007 09:58:49 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail