| View previous topic :: View next topic |
| Author |
Message |
Margreiter Guest
|
Posted: Sat Jan 14, 2006 11:31 am Post subject: TCP Client / Server |
|
|
Hi,
I send files form a TCPClient to a TCPServer.
Client:
TCPClient->WriteStream(strm, true, true, strm->Size);
How can I get informations about status of transmition,
where can I read out how many bytes transmitted??
Thank you for help!
Johann
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Jan 17, 2006 8:03 pm Post subject: Re: TCP Client / Server |
|
|
"Margreiter" <ma (AT) soft-hard-ware (DOT) at> wrote
| Quote: | How can I get informations about status of transmition,
where can I read out how many bytes transmitted??
|
Use the OnWork... events.
Gambit
|
|
| Back to top |
|
 |
Margreiter Guest
|
Posted: Thu Jan 19, 2006 8:15 am Post subject: Re: TCP Client / Server |
|
|
| Quote: | Use the OnWork... events.
|
I tried this already, but this event is never fired.
Are there some preparations necessary?
Johann
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jan 19, 2006 8:30 am Post subject: Re: TCP Client / Server |
|
|
"Margreiter" <ma (AT) soft-hard-ware (DOT) at> wrote
| Quote: | I tried this already
|
Please show your actual code.
| Quote: | but this event is never fired.
|
Yes, they are.
Gambit
|
|
| Back to top |
|
 |
Margreiter Guest
|
Posted: Thu Jan 19, 2006 10:13 am Post subject: Re: TCP Client / Server |
|
|
| Quote: | I tried this already
Please show your actual code.
|
transmitting large files may take a long time, so I want to install a simple
indicator, how many bytes are transfered.
try
{
TMemoryStream* strm = new TMemoryStream;
.....
Form1->TCPDataClient->Host = IPAdr;
Form1->TCPDataClient->Connect();
strm->LoadFromFile(SPath);
Form1->TCPDataClient->WriteStream(strm, true, true, strm->Size);
.....
}
| Quote: | but this event is never fired.
Yes, they are.
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jan 19, 2006 5:55 pm Post subject: Re: TCP Client / Server |
|
|
"Margreiter" <ma (AT) soft-hard-ware (DOT) at> wrote
| Quote: | transmitting large files may take a long time, so I want to
install a simple indicator, how many bytes are transfered.
|
That is what the OnWork events are for. But you did not show where they are
being assigned, or what their code looks like.
| Quote: | TMemoryStream* strm = new TMemoryStream;
|
Why are you loading the entire file into memory before sending it? If you
use a TFileStream instead, then you can send the file directly
TFileStream* strm = new TFileStream(SPath, fmOpenRead |
fmShareDenyWrite);
...
Form1->TCPDataClient->WriteStream(strm, true, true, 0);
...
Gambit
|
|
| Back to top |
|
 |
Margreiter Guest
|
Posted: Sun Jan 22, 2006 4:22 pm Post subject: Re: TCP Client / Server |
|
|
| Quote: | That is what the OnWork events are for. But you did not show where they
are
being assigned, or what their code looks like.
|
I tried to get the information in th OnWork event:
void __fastcall TForm1::TCPDataClientWork(TObject *Sender,
TWorkMode AWorkMode, const int AWorkCount)
{
StatusBar1->SimpleText = AnsiString(AWorkCount);
}
but this event is never fired.
Do I have to assign or to initialize these events somewhere earlier?
| Quote: | Why are you loading the entire file into memory before sending it? If you
use a TFileStream instead, then you can send the file directly
TFileStream* strm = new TFileStream(SPath, fmOpenRead |
fmShareDenyWrite);
...
Form1->TCPDataClient->WriteStream(strm, true, true, 0);
...
|
I did not realize this function.
thank you
Johann
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Jan 23, 2006 7:37 am Post subject: Re: TCP Client / Server |
|
|
"Margreiter" <ma (AT) soft-hard-ware (DOT) at> wrote
| Quote: | I tried to get the information in th OnWork event:
|
You are not differentiating between reading and writing activities. You
should be looking at the AWorkMode parameter before processing the
AWorkCount parameter.
| Quote: | this event is never fired.
|
I can guarantee to you that is is ALWAYS triggered. If it is not, then you
have a buggy version of Indy. Which EXACT version of Indy are you actually
using?
Gambit
|
|
| Back to top |
|
 |
Margreiter Guest
|
Posted: Mon Jan 23, 2006 4:21 pm Post subject: Re: TCP Client / Server |
|
|
| Quote: |
I can guarantee to you that is is ALWAYS triggered. If it is not, then
you
have a buggy version of Indy. Which EXACT version of Indy are you
actually
using?
I am using version 9_00_17 |
Johann
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Jan 23, 2006 5:35 pm Post subject: Re: TCP Client / Server |
|
|
"Margreiter" <ma (AT) soft-hard-ware (DOT) at> wrote
| Quote: | I am using version 9_00_17
|
That is an old build. The current Development Snapshot is 9.0.50. You
should consider upgrading, and see if the problem still persists.
Gambit
|
|
| Back to top |
|
 |
|