<div dir="ltr">2013/5/6 Ludo Brands <span dir="ltr"><<a href="mailto:ludo.brands@free.fr" target="_blank">ludo.brands@free.fr</a>></span><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


In TTcpIpClientSocketThread.Execute you do a read followed by a select.<br>
The logic is: first select then read when something is available.<br></blockquote><div><br></div><div style>Sorry, but I don't understand well this part. :/ In the old code I not used select, and now I'm using it just to know that recv received data, but without lock the application.</div>

<div style>But if there is how to improve, feel free buddy, I noticed that you know well about sockets. :)<br></div><div style><br></div><div style>I can add your SSH key on my Bitbucket account and you can commit directly in this code. Or, if your prefer, you can send me GIT patches. Feel free again.<br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
The sleep(0) is not needed. Select suspends already the thread when waiting.<br></blockquote><div><br></div><div style>Done. I removed that.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


          VTimeVal.tv_sec := 0;<br>
          VTimeVal.tv_usec := 100;<br>
That is 100 microseconds which is very short.</blockquote><div><br></div><div style>Is 500us good value for delay?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 On top of that, when the timeout expires, you test if FDisconnectClient is set and, if not set,<br>
you do the read immediately again. The read is therefor again hanging<br>
until something comes in.<br></blockquote><div><br></div><div style>Yes. I needed it when I made a small HTTP server and I needed to disconnect the client in each request. There are a best way to do it? :/</div><div> </div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Watch out for Synchronize(@DoReceive) in a recv loop. That is going to<br>
drag down your performance considerably.<br></blockquote><div><br></div><div style>I don't understand well this part hehe... Hm... In some tests I did not see decreased performance, please could you show me an example decreasing the performance? I need to reproduce the problem, and debug the code to improve it.</div>

<div><br></div><div style>Thank you very much for the explanations again. On the end of it maybe we have a nice multi-threaded component for work with TCP/IP. :)</div><div><br></div><div>-- </div></div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div></div>