<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 03 May 2013, at 22:56, Zaher Dirkey wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 3, 2013 at 11:47 PM, Zaher Dirkey <span dir="ltr"><<a href="mailto:parmaja@gmail.com" target="_blank">parmaja@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div class="gmail_quote">On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort <span dir="ltr"><<a href="mailto:marcov@stack.nl" target="_blank">marcov@stack.nl</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
That's the point. Don't. Use a select, it has a timeout, and accept only if<br>
select shows activity on the listened to socket.</blockquote></div><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">​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​</div>
</blockquote></div><br><div class="gmail_default" style="font-family:tahoma,sans-serif">​I use "Select"​ for incoming Data not for incoming client connections!<br></div></div></div></blockquote><div><br></div>It doesn't matter. A few facts:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- You create a listening socket which you pass as an argument to accept().</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>- A socket is a file descriptor.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Select operates on file descriptors. Read the man page of select [<a href="http://linux.die.net/man/2/select">http://linux.die.net/man/2/select</a>] and you'll see that the exact purpose of select is to query whether or not the next IO operation is going to block.<br></div><div><br></div><div>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?</div><div><br></div><div>PS: The exact details of this implementation I do not know, I haven't tested.</div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-size: medium; color: rgb(0, 0, 0); font-style: normal; ">--</div><div style="font-size: medium; color: rgb(0, 0, 0); font-style: normal; ">Ewald</div></div></span></div></span></div></span></div></span></span>
</div>
<br></body></html>