Computing.Net > Forums > Programming > Delphi Threads/FTP Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Delphi Threads/FTP Help

Reply to Message Icon

Name: ajbufort
Date: April 4, 2004 at 22:24:38 Pacific
OS: Windows 2000
CPU/Ram: 768MB RAM
Comment:

Hello All,

I am writing an app in Delphi that takes continuous captures of the client's screen and FTPs them to a server. I have one thread taking the captures and another FTPing them as they are taken. The speed of the captures far surpasses the speed ot the uploads (as one might expect). The ratio is currently something like 3 jpeg uploads for every 50 screen captures. I need to improve my upload rates so that another app can pick up the 'stream' and display them one after another in a reasonable time frame (this app is Flash MX, by the way).

These two functions, while not all-inclusive in terms of my code, represent my current approach:

function ProcessScreenCaptures(Ptr : Pointer) : LongInt; stdcall;
var
jpeg: TJpegImage;
fileName: string;
x: Integer;
begin
x := 0;

while (KeepProcessing) do
begin
x := x + 1;
fileName := 'screen_' + IntToStr(x) + '.jpg';
jpeg := WindowsScreenCapture;
jpeg.SaveToFile( fileName );
jpeg.Free;
end;
end;

function UploadCaptures(Ptr : Pointer) : LongInt; stdcall;
var
fileName: string;
x: Integer;
begin

x := 0;

while (KeepProcessing) do
begin
MakeFTPConnection();
x := x + 1;
fileName := 'screen_' + IntToStr(x) + '.jpg';
UploadFile( fileName );
CloseFTPConnection();
end;
end;

I am a newbie to Windows-API programming, and especially threads, so I am struggling to make this work efficiently.

Yet another problem I am having is that mouse movement on the client becomes 'choppy' once the capture app is started. In an attempt to allieviate these problems, I started peppering my code with 'Application.ProcessMessages' lines. This seems very inelegant to me - I know there has to be a better solution out there. It gave me some performance gains, but not nearly what I need. I need the same skill that the pros have, where they can have an app working away in the background at some heavy task, with the user oblivious to the action all the while. That's what I am shooting for here. I thought threads would give me that, but so far they haven't. I know FTP is a notoriously slow protocol, but there's gotta be something out there that can speed up my app in that regard as well.

Can anyone help me on this? Any advice/schooling would be much appreciated!

Thanks,

-Tony



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Delphi Threads/FTP Help

Delphi 7 Borland help files questio www.computing.net/answers/programming/delphi-7-borland-help-files-questio/8352.html

Delphi question need help with TLis www.computing.net/answers/programming/delphi-question-need-help-with-tlis/3408.html

printing richedit in delphi www.computing.net/answers/programming/printing-richedit-in-delphi/3075.html