[fpc-pascal] How to close TInetServer without except?

silvioprog silvioprog at gmail.com
Sat May 4 07:47:23 CEST 2013


2013/5/4 Ludo Brands <ludo.brands at free.fr>

> On 05/03/2013 05:57 PM, silvioprog wrote:
> > Could you give me an example in practice? Theoretically I understand,
> > but I don't know do in practice. :/
> >
> > Now, TTcpIpServer is working well. The new problem is: when I close the
> > server with one or more clients connected, I got a memory leak.
> >
>
> Take a look at TBlockSocket.InternalCanRead and TBlockSocket.CanRead in
> synapse on how to set up select correctly. Then do something like
>
> repeat
>   if Socket.CanRead(timeout) then
>     begin
>     insock:=Socket.Accept;
>     if insock<>-1 then
>       //start working with insock
>     else
>       //deal with error
>     end;
> until ThreadTerminated;
>
> Ludo


Thank you!

-- 
Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130504/4391b729/attachment.html>


More information about the fpc-pascal mailing list