🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
10 messages
10 total messages Started by Margreiter Sat, 14 Jan 2006 11:31
TCP Client / Server
#2799
Author: Margreiter
Date: Sat, 14 Jan 2006 11:31
11 lines
1183 bytes
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
Re: TCP Client / Server
#2805
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Jan 2006 20:03
11 lines
1161 bytes
"Margreiter" <ma@soft-hard-ware.at> wrote in message
news:43c8dfc3@newsgroups.borland.com...

> How can I get informations about status of transmition,
> where can I read out how many bytes transmitted??

Use the OnWork... events.


Gambit
Re: TCP Client / Server
#2816
Author: Margreiter
Date: Thu, 19 Jan 2006 08:15
7 lines
1086 bytes
> Use the OnWork... events.

I tried this already, but this event is never fired.
Are there some preparations necessary?


Johann 
Re: TCP Client / Server
#2817
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Jan 2006 08:30
14 lines
1219 bytes
"Margreiter" <ma@soft-hard-ware.at> wrote in message
news:43cf4937@newsgroups.borland.com...

> I tried this already

Please show your actual code.

> but this event is never fired.

Yes, they are.


Gambit
Re: TCP Client / Server
#2818
Author: Margreiter
Date: Thu, 19 Jan 2006 10:13
26 lines
1586 bytes
>> 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);
       .....
 }
>> but this event is never fired.
>
> Yes, they are.
>
>
> Gambit
>
> 
Re: TCP Client / Server
#2819
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Jan 2006 17:55
23 lines
1840 bytes
"Margreiter" <ma@soft-hard-ware.at> wrote in message
news:43cf64ce$1@newsgroups.borland.com...

> 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.

>        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
Re: TCP Client / Server
#2828
Author: Margreiter
Date: Sun, 22 Jan 2006 16:22
28 lines
1965 bytes
> 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?



> 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 
Re: TCP Client / Server
#2832
Author: Remy Lebeau (TeamB)
Date: Mon, 23 Jan 2006 07:37
18 lines
1704 bytes
"Margreiter" <ma@soft-hard-ware.at> wrote in message
news:43d3afc5@newsgroups.borland.com...

> 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.

> 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
Re: TCP Client / Server
#2833
Author: Margreiter
Date: Mon, 23 Jan 2006 16:21
10 lines
1404 bytes
>
> 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 
Re: TCP Client / Server
#2834
Author: Remy Lebeau (TeamB)
Date: Mon, 23 Jan 2006 17:35
11 lines
1472 bytes
"Margreiter" <ma@soft-hard-ware.at> wrote in message
news:43d50123@newsgroups.borland.com...

> 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads