[fpc-pascal] INVALID_SOCKET constant not defined for Linux

Michael Van Canneyt michael at freepascal.org
Tue Mar 28 12:19:37 CEST 2017

On Tue, 28 Mar 2017, LacaK wrote:

> Hi,
> I am porting application from Windows to Linux. I use Sockets unit.
> There is defined on Windows (and also on BeOS, FreeBSD, OS2):
>   INVALID_SOCKET = TSocket(Not 0); // or -1
>   SOCKET_ERROR = -1;
> But not for Linux. Does it means, that result of unsuccessfull call to 
> Sockets.FPSocket can be other than -1 ?
> (in fcl-net is used test for -1 to check invalid socket so I think, that 
> it is crossplatform ... if yes why isn't INVALID_SOCKET defined also for 
> Linux in RTL?)

Because we don't want to pollute the unix units with windows-isms.

If it is a POSIX defined constant, we can add it, but if it is not: 
too bad.


More information about the fpc-pascal mailing list