[fpc-pascal] INVALID_SOCKET constant not defined for Linux

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Mar 28 14:07:49 CEST 2017


Il 28/03/2017 12:34, LacaK ha scritto:
> This technique is used in fcl-net which should be cross-platform.
> So I am right, when I say that also in Linux invald socket = -1
> (in other words: in case of error syscall() returns always -1)
>
> Becuase in other place I see another test "if socket < 0 then ..."
> (which may mean that any negative value can be returned) 

Most likely this is only because "socket < 0" is faster to write than 
"socket = -1" :-)

 From Linux man page for socket:

> RETURN VALUE
>        On success, a file descriptor for the new socket is returned.  On
>        error, -1 is returned, and errno is set appropriately.

Giuliano





More information about the fpc-pascal mailing list