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

Ewald ewald at yellowcouch.org
Fri May 3 22:25:30 CEST 2013


On 03 May 2013, at 20:13, Marco van de Voort wrote:

> In our previous episode, Ewald said:
>> 
>> 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)
> 
> Select on the main socket before doing the accept? 

Yep, possibly the most simple and effective recipe (not much code to add, no radical changes, no overkill). Shame on me for not thinking of that ;-)

--
Ewald




More information about the fpc-pascal mailing list