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

> 
> On Fri, May 3, 2013 at 11:47 PM, Zaher Dirkey <parm...@gmail.com> wrote:
> On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort <mar...@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.

--
Ewald

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to