Roman Haefeli wrote:
On Wed, 2009-03-04 at 00:45 +0100, Roman Haefeli wrote:
how do i know, when the [tcpserver] socket is ready to transmit another byte? do i have to nag it every ms with a message? if i go the BYTE-AT-A-TIME route, the interval would even need to be slower, if higher troughput should be achieved. is there any strategy to avoid too much overhead?
having thought another two minutes about it, i think i can answer my own question: i don't need to drip every byte with an interval, but just fill the buffer completely in zero logical time, then i wait a few miliseconds, then i do it again. depending on the wait time, the connection bandwidth and the buffersize, the buffer will be filled again before it completely got empty. this way the maximum available bandwidth can be exploited, when necessary, without having to penetrate [tcpserver] too much with 'buffer still full?' messages.
You could also try setting the buffer size the same as the message length for each outgoing message. Then the buffer wouldn't consume thousands of bytes before it stopped.
martin, would you mind implementing similar changes to [tcpclient] as well?
I'll do that today if I have time.
Martin