🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
5 messages
5 total messages Started by supaul Tue, 17 Jan 2006 05:51
TidTCPConnection read data delay
#2802
Author: supaul
Date: Tue, 17 Jan 2006 05:51
34 lines
1914 bytes
I build a client/server program, use TIdTCPServer in Server and use
TIdTCPClient in Client, as fllowing:
--------------------------------------------------
Server: in on execute event, i write some codes
TIdTCPServer.OnExecute(AThread: ...)
var
  I: Integer;
begin
  I:= AThread.Connection.ReadInteger;
  I:= 10;
  AThread.Connection.WriteInteger(I);
  I:= 20;
  AThread.Connection.WriteInteger(I);
end;

Client: in a button's click event

OnButtonClick(Sender: TObject)
var
  I: Integer;
begin
  I:= 10;
  TCPClient.WriteInteger(I);
  I:= TCPClient.ReadInteger;

  //the following line has some error
  I:= TCPClient.ReadInteger;
end;
-------------------------------------------------------------
while my server app and client app run in the same computer, the line in
codes mark with red will run normal, and speed is fast. But while server app
and client app run in two computers, client app will delay(the line mark
with red in codes), please tell me how to solve this problem?
Re: TidTCPConnection read data delay
#2804
Author: Bob Gonder
Date: Tue, 17 Jan 2006 17:28
27 lines
2075 bytes
supaul wrote:

>while my server app and client app run in the same computer, the line in
>codes mark with red will run normal, and speed is fast. But while server app
>and client app run in two computers, client app will delay(the line mark
>with red in codes), please tell me how to solve this problem?

(There are no colors in the newsgroup, better to mark the lines with
comments)

See my message from 5/4/2005
50th71db9qmpnog2gldkeqvsfv112h3ano@4ax.com

Subject: Re: sendto to same destination more times after eachother
fails.?


TCP buffers data so the data-to-packetheader ratio is sane. When
sending a single integer, the packet is several times the size of the
data, quite wastefull, so by default, TCP holds onto the data for a
period of time, hoping more data will be sent.
If you don't want to wait for the timeout, you need to tell TCP not to
wait.

Look into this WinSock API command, and parameters..

setsockopt(ClientOutSocket,IPPROTO_TCP,TCP_NODELAY,(char*)&t,sizeof(t));
Re: TidTCPConnection read data delay
#2806
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Jan 2006 20:06
16 lines
1328 bytes
"supaul" <qzwusir@163.com> wrote in message
news:43cc863b@newsgroups.borland.com...

> I build a client/server program, use TIdTCPServer in
> Server and use TIdTCPClient in Client, as fllowing:

Which version of Indy you are using?

>   //the following line has some error
>   I:= TCPClient.ReadInteger;

Please be more specific.  What EXACTLY is happening?


Gambit
Re: TidTCPConnection read data delay
#2808
Author: supaul
Date: Wed, 18 Jan 2006 03:57
34 lines
2170 bytes
Thanks, it is correct!
"Bob Gonder" <notbg@notmindspring.invalid>
??????:ap9qs1pu7b6mf7cn9v9gejknfau59l1nmv@4ax.com...
> supaul wrote:
>
> >while my server app and client app run in the same computer, the line in
> >codes mark with red will run normal, and speed is fast. But while server
app
> >and client app run in two computers, client app will delay(the line mark
> >with red in codes), please tell me how to solve this problem?
>
> (There are no colors in the newsgroup, better to mark the lines with
> comments)
>
> See my message from 5/4/2005
> 50th71db9qmpnog2gldkeqvsfv112h3ano@4ax.com
>
> Subject: Re: sendto to same destination more times after eachother
> fails.?
>
>
> TCP buffers data so the data-to-packetheader ratio is sane. When
> sending a single integer, the packet is several times the size of the
> data, quite wastefull, so by default, TCP holds onto the data for a
> period of time, hoping more data will be sent.
> If you don't want to wait for the timeout, you need to tell TCP not to
> wait.
>
> Look into this WinSock API command, and parameters..
>
> setsockopt(ClientOutSocket,IPPROTO_TCP,TCP_NODELAY,(char*)&t,sizeof(t));
>
>
>
Re: TidTCPConnection read data delay
#2807
Author: supaul
Date: Wed, 18 Jan 2006 03:58
24 lines
1785 bytes
when tcpclient read from server, it always delay 200ms, now it is correct, I
set then socket.UseNagle to false!
Thanks:)

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> д����Ϣ����
:43cd4e31$1@newsgroups.borland.com...
>
> "supaul" <qzwusir@163.com> wrote in message
> news:43cc863b@newsgroups.borland.com...
>
> > I build a client/server program, use TIdTCPServer in
> > Server and use TIdTCPClient in Client, as fllowing:
>
> Which version of Indy you are using?
>
> >   //the following line has some error
> >   I:= TCPClient.ReadInteger;
>
> Please be more specific.  What EXACTLY is happening?
>
>
> 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