<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-04-25 10:05 GMT-03:00 silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>></span>:<br><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">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-04-25 3:39 GMT-03:00 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span>:</div>
<div class="gmail_quote">[...]<span style="color:rgb(80,0,80)"> </span><div class=""><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">
Damn windows returning 0 on read... Can you please test with the following change:<div><br>
<br>
Procedure FillBuffer;<br>
<br>
Var<br>
R : Integer;<br>
<br>
begin<br>
SetLength(FBuffer,ReadBufLen);<br></div>
Repeat<br>
r:=FSocket.Read(FBuffer[1],<u></u>ReadBufLen);<div><br>
If r<0 then<br>
Raise EHTTPServer.Create(<u></u>SErrReadingSocket);<br></div>
if R=0 then<br>
Sleep(10);<br>
Until (R<>0);<br>
if (R<ReadBuflen) then<br>
SetLength(FBuffer,r);<br>
end;</blockquote></div></div><div><br></div><div><div>After apply this change, now when read returns 0, it freezes the app., because the "sleep(10)" command is infinitely called. :/</div><div><br></div><div>
Damn windows!</div></div></div></div></blockquote></div><div><br></div><div><div>I have no much experience with sockets on Windows, but I saw two links:</div><div><br></div><div><a href="http://stackoverflow.com/questions/10526382/recv-returns-0">http://stackoverflow.com/questions/10526382/recv-returns-0</a></div>
<div><br></div><div><a href="http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable">http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable</a></div>
<div><br></div><div>Seems that error occurs when client disconnects from server. :/</div></div><div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>