🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5308

Re: How can I send a TBitmap from Client application to Server application

#5308
From: Mark Jacobs
Date: Tue, 21 Sep 2004 19:57
39 lines
2159 bytes
Just change

| 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);
| }

to

| void __fastcall TForm1::ClientSocket1Read(TObject *Sender,
|       TCustomWinSocket *Socket)
| {
|     TMemoryStream *pms=new TMemoryStream();
|     int count=Socket->ReceiveLength();
|     char *Buf=new char[count+9];
|     while (count>0)
|     {
|        Socket->ReceiveBuf(Buf,count); pms->Write(Buf,count);
|        count=Socket->ReceiveLength();
|     }
|     delete Buf; pms->Position=0;
|     Image1->Picture->Bitmap->LoadFromStream(pms);
|     delete pms;
| }

-- 
Mark Jacobs

"Byanex" <chikui@bol.com.br> wrote in message
news:415080c1$1@newsgroups.borland.com...
|
| Well, some thing is not right...
Technical Details
Message-ID: <415087be$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <407e54f8$1@newsgroups.borland.com> <407e66c5@newsgroups.borland.com> <407ec9c7@newsgroups.borland.com> <415080c1$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b60555b8e5a57a55
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mark Jacobs" <mark@losethisbitjacobsm.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <407e54f8$1@newsgroups.borland.com> <407e66c5@newsgroups.borland.com> <407ec9c7@newsgroups.borland.com> <415080c1$1@newsgroups.borland.com>
Subject: Re: How can I send a TBitmap from Client application to Server application
Date: Tue, 21 Sep 2004 20:57:31 +0100
Lines: 40
Organization: DK Computing
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 81.86.186.94
Message-ID: <415087be$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095796670 81.86.186.94 (21 Sep 2004 12:57:50 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail