Article View: borland.public.cppbuilder.internet.socket
Article #5306Re: How can I send a TBitmap from Client application to Server application
From: Byanex
Date: Tue, 21 Sep 2004 19:28
Date: Tue, 21 Sep 2004 19:28
29 lines
1833 bytes
1833 bytes
Well, some thing is not right...
On server my code for send a bitmap from a TImage componenet is:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TMemoryStream* pms = new TMemoryStream();
Image1->Picture->Bitmap->SaveToStream(pms);
pms->Position=0;
ServerSocket1->Socket->Connections[0]->SendStream(pms);
}
None erros cod generated, but i'm not sure about what to do to read wich ReceiveBuf on the client side, i'm trying to use this:
void __fastcall TForm1::ClientSocket1Read(TObject *Sender,
TCustomWinSocket *Socket)
{
short count=Socket->ReceiveLength();
char *Buf = new char[count];
Socket->ReceiveBuf( Buf, cont);
TMemoryStream* pms = new TMemoryStream();
pms->Write(Buf, cont);
pms->Position=0;
Image1->Picture->Bitmap->LoadFromStream(pms);
}
In this way many errors happen. :(
Any help please
Thanks Byanex
Technical Details
Message-ID:
<415080c1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<407e54f8$1@newsgroups.borland.com> <407e66c5@newsgroups.borland.com> <407ec9c7@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b60555b8e5a57a55,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Byanex" <chikui@bol.com.br> Sender: "Byanex" <chikui@bol.com.br> Reply-To: "Byanex" <chikui@bol.com.br> Subject: Re: How can I send a TBitmap from Client application to Server application Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 200.146.159.246 References: <407e54f8$1@newsgroups.borland.com> <407e66c5@newsgroups.borland.com> <407ec9c7@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <415080c1$1@newsgroups.borland.com> Date: 21 Sep 2004 12:28:01 -0700 X-Trace: newsgroups.borland.com 1095794881 207.105.83.66 (21 Sep 2004 12:28:01 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail