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

Ewald ewald at yellowcouch.org
Fri May 3 23:19:54 CEST 2013

On 03 May 2013, at 22:56, Zaher Dirkey wrote:

> On Fri, May 3, 2013 at 11:47 PM, Zaher Dirkey <parmaja at gmail.com> wrote:
> On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort <marcov at stack.nl> wrote:
> That's the point. Don't. Use a select, it has a timeout, and accept only if
> select shows activity on the listened to socket.
> ​Not sure, but i believe i used it in the past and have problems with it, We can leave it to silvio to test it :P​
> ​I use "Select"​ for incoming Data not for incoming client connections!

It doesn't matter. A few facts:
	- You create a listening socket which you pass as an argument to accept().
	- A socket is a file descriptor.
	- Select operates on file descriptors. Read the man page of select [http://linux.die.net/man/2/select] and you'll see that the exact purpose of select is to query whether or not the next IO operation is going to block.

Now that we have established these two facts, I believe that using select before accept to check whether the latter will block is valid logic, wouldn't you say?

PS: The exact details of this implementation I do not know, I haven't tested.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130503/21a77639/attachment.html>

More information about the fpc-pascal mailing list