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

Ewald ewald at yellowcouch.org
Fri May 3 19:07:14 CEST 2013


Once upon a time, Zaher Dirkey said:
> On Fri, May 3, 2013 at 7:22 PM, Ewald <ewald at yellowcouch.org> wrote:
>
>> "Accept" but without errors
>
> ​You cant, Accept give you a handle of new socket or give you an error, not
> all is fatal error, just check what is it, if it a closed handle or
> shutdown.​
Yes, I know that.

The point being that the answer to one of the OP sub-problems [the one
quoted _partially_ above], can be to either use:
- pthread_cancel() [overkill, I know, but nonetheless a solution]
- non-blocking sockets [not very code-efficient IMHO if you only want to
exit an application gracefully (high code versus ouput ratio)]
- something different (one can try experimenting with shutting down the
listening socket, using signals, ... but I haven't done so, so I can't
give any feedback on this)

-- 
Ewald




More information about the fpc-pascal mailing list