2014-04-25 10:05 GMT-03:00 silvioprog <silviop...@gmail.com>:

> 2014-04-25 3:39 GMT-03:00 Michael Van Canneyt <mich...@freepascal.org>:
> [...]
>
>> Damn windows returning 0 on read... Can you please test with the
>> following change:
>>
>>
>>    Procedure FillBuffer;
>>
>>    Var
>>      R : Integer;
>>
>>    begin
>>      SetLength(FBuffer,ReadBufLen);
>>      Repeat
>>        r:=FSocket.Read(FBuffer[1],ReadBufLen);
>>
>>        If r<0 then
>>          Raise EHTTPServer.Create(SErrReadingSocket);
>>        if R=0 then
>>          Sleep(10);
>>      Until (R<>0);
>>      if (R<ReadBuflen) then
>>        SetLength(FBuffer,r);
>>    end;
>
>
> After apply this change, now when read returns 0, it freezes the app.,
> because the "sleep(10)" command is infinitely called. :/
>
> Damn windows!
>

I have no much experience with sockets on Windows, but I saw two links:

http://stackoverflow.com/questions/10526382/recv-returns-0

http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable

Seems that error occurs when client disconnects from server. :/

-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to