Thanks Wilfred, but I need to send the next message only after I receive the
ok from server.



Wilfried Mestdagh wrote:

>Hello Larini,
>
>>I'm getting unstable times, from 70 ms to 3 seconds.
>
>
>This can happen. It is depending the traffic on the network. If very
>heavy on a large network it _can_ take a while.
>
>>while gWait do
>>begin
>>application.ProcessMessages;
>>sleep(1);
>>end;
>
>
>This is not needed, you only waste CPU here. Use ClientDataAvailable to
>send the next, not for flagging a loop !
>
>---
>Rgds, Wilfried [TeamICS]
>http://www.overbyte.be/eng/overbyte/teamics.html
>http://www.mestdagh.biz
>
>Wednesday, November 9, 2005, 21:26, Larini wrote:
>
>>Hi, here is my simple app, one client and one server. The mission: send a
>>message from client to server and wait for replay.
>>I'm getting unstable times, from 70 ms to 3 seconds. My question is: this
is
>>normal? What kind of client-server configuration I must have to get more
>>stable results (like 200 ms most of time)?
>
>
>
>>Client:
>>procedure TForm2.clientSessionConnected(Sender: TObject; ErrCode: Word);
>>var a:Integer;
>>begin
>>for a:=0 to 500 do
>>begin
>>LastTick:=Gettickcount;
>>Client.SendLine('************************************************* msg to
>>server *****************************************');
>>gWait:=true;
>>while gWait do
>>begin
>>application.ProcessMessages;
>>sleep(1);
>>end;
>>end;
>>end;
>
>
>>procedure TForm2.clientDataAvailable(Sender: TObject; ErrCode: Word);
>>var s:String;
>>begin
>>if ErrCode<>0 then
>>exit;
>>s:=Client.ReceiveStr;
>>memo1.lines.add(Inttostr(Gettickcount-LastTick)+' - '+ trim(s));
>>gWait:=false;
>>end;
>
>
>>Server:
>>procedure TForm1.CliSocketDataAvailable(Sender: TObject; ErrCode: Word);
>>var s:String;
>>begin
>>if ErrCode<>0 then
>>exit;
>>s:=(sender as TWSocket).ReceiveStr;
>>memo1.Lines.Add(trim(s));
>>(sender as TWSocket).SendLine(trim(s));
>>end;
>
>
>
________________________________________________
This mail was sent by
Webmail 2.5

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to