🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1452

quick data copy between objects

#1452
From: Robert G. Hoover
Date: Wed, 01 Aug 2007 21:06
40 lines
2086 bytes
Hi All,

I've got a timing/performance need... I'm trying to capture the screen as BMP,
compress to JPG, then send over a TCustomWinSocket. I'm afraid it just takes too
long... :(  Here's what I've got going on...

...


// capture entire screen and copy data to TBitmap
BitBlt(ImageBMP->Canvas->Handle,
       0, 0, ImageBMP->Width, ImageBMP->Height,
       hCaptureDC, 0, 0, SRCCOPY);

// convert to JPG
ImageJPG->Assign(ImageBMP);

// convert to memory stream for sending over socket
ImageJPG->SaveToStream(WriteStream);

// disable Nagle algorithm to speed up transmissions???
TWinSocket_SetSockOpt(SocketOut, IPPROTO_TCP, TCP_NODELAY, 1);

// send image data to client
SocketOut->SendBuf(WriteStream->Memory, WriteStream->Size);

// reset stream for next use
WriteStream->Clear();


...


So, is there any way to speed up any or all of these operations? It takes (as
near as I can measure) ~1.5 seconds to send over the data. Any and all advice is
much appreciated...

Many thanks!

Rob
Technical Details
Message-ID: <46b0f5c4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2f02e67f1be3ea63,start
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 01 Aug 2007 17:06:05 -0400
From: "Robert G. Hoover" <not.a.real.address@anywhere.sorry>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: quick data copy between objects
X-Enigmail-Version: 0.94.1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 000763-0, 08/01/2007), Outbound message
X-Antivirus-Status: Not-Tested
NNTP-Posting-Host: 68.55.87.76
Message-ID: <46b0f5c4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1186002372 68.55.87.76 (1 Aug 2007 14:06:12 -0700)
Lines: 40
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail