Hello Juan,

> If I use TCP, the time is over. I need transfer important data in little time.

Ok. If it is not importand to loose data (you can ask server to transfer
it later) because real time is more importand then you have to use UDP,
but if speed is importand then read on.

For the packets you send, you have to number them some way. Later when
time is not critism anymore, the receiver can ask sender to re tranmit
lost packets.

To loose minimum yoiu have to gain speed as mutch as possible on
receiver:

>      s:=StrPas(Buffer);

Dont make extra copies of your received data, you loose time.

>       processMessage(s);

No: ProcessMessage(@Buffer);
Only give a pointer to data to function for speed

> procedure processMessage(s: string);
> begin
>          parsing message and save in array[];
> end;

Only if you have to change data. If you dont have to change then you
make array of Buffer to not need extra copy (we are here on the 3th copy
of received data).

---
Rgds, Wilfried
http://www.mestdagh.biz

Friday, August 19, 2005, 18:16, Juan Pablo Franco wrote:

> Again,

> If I use TCP, the time is over. I need transfer important data in little time.

> SENT MACHINE
> overlaySocket.SendStr(Msg);


> RECEIVE MACHINE:
> procedure TFVisor.overlayListenDataAvailable(Sender: TObject; ErrCode: Word);
> var
>      Buffer : array [0..50000] of char;
>      Src    : TSockAddrIn;
>      Len, SrcLen: Integer;
>      s:string;
> begin
>      overlayListen.BufSize := 16384;
>      SrcLen := SizeOf(Src);
>      overlayListen.Receive(@Buffer, SizeOf(Buffer));
>      s:=StrPas(Buffer);

>       processMessage(s);
>       ...
> end;

> procedure processMessage(s: string);
> begin
>          parsing message and save in array[];
> end;

> in other process of RECEIVE MACHINE:
> begin
>          while (don't stop application) do
>          begin
>                  paint(array[])----> pass throught
>          end;
> end;

> IF I USE TCP IS PROBABLY THAT BUFFER COLAPSE????

> THANKS AGAIN




> At 11:53 19/08/2005, you wrote:
>>Hello Juan,
>>
>>This can explain wy you loose data. UDP is fast but not realble. If you
>>dont want to loose data then you have to use TCP.
>>
>>---
>>Rgds, Wilfried
>>http://www.mestdagh.biz
>>
>>Friday, August 19, 2005, 16:11, Juan Pablo Franco wrote:
>>
>> > Hi Guillaume,
>>
>> > I am using Tsocket UDP because I need transfer high speed data, but is more
>> > complicated because the sent machine send 720 strings in 4 seconds, and a
>> > string maybe contained large data.
>> > The most important in the application is the time, then receive data and
>> > process it must be fastest.
>> > Thanks.
>>
>>
>>--
>>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


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