Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jan : Re: TClientSocket write progress???
| Subject: | Re: TClientSocket write progress??? |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Tue, 22 Jan 2008 23:22:44 |
"Bo Berglund" <bo.berglund@telia.com> wrote in message
news:ufncp3187nor6q3vqbmhsme40j8oflsv60@4ax.com...
> Can this be done with a TClientSocket?
Yes. You already know how many bytes you are asking TClientSocket to send,
you know how many bytes it actually sends (the return value of SendBuf()),
and you know the size of the file you are sending, so simply update your
progress bar whenever you send a block of data.
> Is there an event or similar that fires at certain amounts of
> written bytes or similar?
No.
> If not, is it at all possible to have a progressbar when sending
> multi-megabyte files?
Of course.
> Basically I need the same when receiving large files of course...
In the OnRead event, you know how many bytes were received, and you
(presumably) know the size of the file you are receiving, so simply update
the progress bar whenever a block of data is received.
Gambit