[twsocket] Send one big or a lot of small strings

2005-11-01 Thread Larini
Hi, I want to know if there are a difference between the two codes bellow: MyString = 100 bytes 1. For a:=0 to 80 do socket.SendStr(MyString); 2. For a:=0 to 80 do aux:=aux+MyStr; socket.SendStr(aux); The first one, sends about 8000 bytes using 80 sendstr commands The second send about 8000

Re: [twsocket] Send one big or a lot of small strings

2005-11-01 Thread Wilfried Mestdagh
Hello Larini, for winsock it will end up probably the same, but in (2) you are 80 times re-allocating memory and probably copying bytes several times. if you really dont can create the send buffer at once you can do this: for a := 0 to 80 do Socket.PutStringInSendBuffer(MyString);

Re: [twsocket] Send one big or a lot of small strings

2005-11-01 Thread Arno Garrels
Larini wrote: Hi, I want to know if there are a difference between the two codes bellow: MyString = 100 bytes 1. For a:=0 to 80 do socket.SendStr(MyString); 2. For a:=0 to 80 do aux:=aux+MyStr; socket.SendStr(aux); The first one, sends about 8000 bytes using 80 sendstr

Re: [twsocket] Send one big or a lot of small strings

2005-11-01 Thread Larini
Why this event must be used? I'm testing my application and some times a send of a small packet take 1 second, other times the same packet take about no time. There is a way to force send anyway? This mail was sent by Webmail 2.5 -- To

Re: [twsocket] Send one big or a lot of small strings

2005-11-01 Thread Arnaldo Braun
You can force socket faster small packet sending by using TWsocket --- ComponentOptions wsoTcpNoDelay --- true See Microsoft socket help files about possible collateral effects (search setsockopt TCP_NODELAY) Larini wrote: Why this event must be used? I'm testing my application and

Re: [twsocket] Send one big or a lot of small strings

2005-11-01 Thread Wilfried Mestdagh
Hello Arnaldo, Yes that is another option, but the 1 second delay he had has nothing to do with it. TCP_NODELAY disable the Nagle algoritm. If my RAM serve me well Nagle will wait at maximum 100 milliseconds for transmit to see if something else is coming. And it will do this delay only if there