In our previous episode, Mark Morgan Lloyd said: > When using a function like fpAccept on a non-blocking socket, in some > cases -1 is returned with a documented (Linux kernel) error code of > EAGAIN. Should I be looking for this in errno or SocketError?
Socketerror is more portable, but on *nix errno will work too. > When I've retrieved a numeric code from errno or SocketError, is there a > way of converting it to a concise literal such as 'EAGAIN'? See errors unit. > I want the > log to report that accept() has failed with EAGAIN, rather than having > explanatory text that doesn't match the kernel documentation. EAGAIN generally means that you should try again. So repeat until repeat res:=dofunc; err:=geterrno; until (res<>-1) or ((err<>ESysEINTR) and (err<>ESysEAgain)); it is a workaround against potential deadlock between userland and kernel iirc. Retrying means it can simple work. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal