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

Ludo Brands ludo.brands at free.fr
Sat May 4 20:42:03 CEST 2013

On 05/04/2013 08:00 PM, Zaher Dirkey wrote:
> Hmm there is diffrents
> Yours
> res:=select(sock+1, at readfds, at writefds, at exceptfds, at tv);
> Mine
> c := WinSock2.select(0, PSetRead, PSetWrite, nil, @TimeVal);
> 0 here in mine, in yours sock+1 (FHandle+1 in mine).
> I will take more testing.

According to
"nfds [in] Ignored. The nfds parameter is included only for
compatibility with Berkeley sockets."

I wrote the code for linux and then "ported" it to windows.

However, in your code you do
if (c = 0) or (c = SOCKET_ERROR) then

which is not correct. c=0 is the result of select returning after a
timeout. It is not an error.
The fact that
   if Socket.Select(10000, slRead) = erNone then
is blocked forever​ is not normal. It should at least return after 10


More information about the fpc-pascal mailing list