[fpc-pascal] How to close TInetServer without except?
ludo.brands at free.fr
Sun May 5 09:53:13 CEST 2013
On 05/04/2013 09:59 PM, Zaher Dirkey wrote:
> now in this example
> They not use Select before accept
If you are happy with accept blocking or if you use non-blocking sockets
you don't need select before accept.
> and in
>>The parameter /readfds/ identifies the sockets that are to be checked
> for readability. If the socket is currently in the *listen*
> state, it will be marked as readable if >an incoming connection request
> has been received such that an *accept*
> is guaranteed to complete *without blocking*.
That is exactly the purpose of select. The timeout guarantees that your
program stays alive and can do something else.
> I still not sure in windows need Select, but maybe in Linux only, but i
> can't test it there.
I repeat, you don't have to use select in Windows or Linux. If you
prefer blocking sockets you don't need select but accept/recv/send will
block. If you use non-blocking sockets you need to deal with EAGAIN or
EWOULDBLOCK (WSAEWOULDBLOCK on windows). There are also alternatives to
select: poll, epoll, libevent, etc., etc. on linux, WSAPoll on windows
Vista and later. For completeness, on windows you have also the
asynchronous overlapped IO mode which is used a lot in high performance
servers but rather complex to program.
More information about the fpc-pascal