In our previous episode, LacaK said:
> 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?)

Under *nix socket calls are just general runtime calls, and they use the
same convention and constants for errorhandling as all other calls.

Under Windows, the winsock part is separate from the C runtime and uses own
constants. Invalid_socket is a winsock constant added to sockets for
convenience (but not portable). Strictly speaking we could add a "platform;"
now to it.

I guess I did't want to encourage winsock (which is the odd one out) coding
in general *nix code.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to