<div dir="ltr">2013/5/5 Ludo Brands <span dir="ltr"><<a href="mailto:ludo.brands@free.fr" target="_blank">ludo.brands@free.fr</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

On 05/04/2013 09:59 PM, Zaher Dirkey wrote:<br>
<br>
> now in this example<br>
> <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspx</a><br>
> They not use Select before accept<br>
><br>
<br>
If you are happy with accept blocking or if you use non-blocking sockets<br>
you don't need select before accept.<br>
<br>
> and in<br>
> <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141%28v=vs.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141%28v=vs.85%29.aspx</a><br>
><br>
>>The parameter /readfds/ identifies the sockets that are to be checked<br>
> for readability. If the socket is currently in the *listen*<br>
> <<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms739168%28v=vs.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/ms739168%28v=vs.85%29.aspx</a>><br>
> state, it will be marked as readable if >an incoming connection request<br>
> has been received such that an *accept*<br>
> <<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspx</a>><br>
> is guaranteed to complete *without blocking*.<br>
><br>
<br>
That is exactly the purpose of select. The timeout guarantees that your<br>
program stays alive and can do something else.<br>
<br>
> I still not sure in windows need Select, but maybe in Linux only, but i<br>
> can't test it there.<br>
><br>
<br>
I repeat, you don't have to use select in Windows or Linux. If you<br>
prefer blocking sockets you don't need select but accept/recv/send will<br>
block. If you use non-blocking sockets you need to deal with EAGAIN or<br>
EWOULDBLOCK (WSAEWOULDBLOCK on windows). There are also alternatives to<br>
select: poll, epoll, libevent, etc., etc. on linux, WSAPoll on windows<br>
Vista and later. For completeness, on windows you have also the<br>
asynchronous overlapped IO mode which is used a lot in high performance<br>
servers but rather complex to program.<br>
<br>
Ludo</blockquote></div><div><br></div><div style>Ludo, I'm almost by completing the units in this link:</div><div><br></div><div><a href="https://bitbucket.org/silvioprog/tcpipcomp">https://bitbucket.org/silvioprog/tcpipcomp</a> (this repository is temporary)<br>

</div><div><br></div><div>The current code (I'm updating it daily) in these units is good? I'm open to suggestions, and we can change whatever it takes.</div><div><br></div><div>I want to send these units to the Free Pascal team and a package to the Lazarus team.<br>

</div><div><br></div><div style>Sorry for my English please.</div><div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>