Most likely this is only because "socket < 0" is faster to write than "socket =
-1" :-)
And is probably faster to execute on most processors which offers a sign flag.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal
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 v
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 ..
Under *nix socket calls are just general runtime calls, and they use the
same convention and constants for errorhandling as all other calls.
As I know "nothing" about Linux, then it is safe to check?:
socket := Sockets.FPSocket(...);
if socket = -1 then // invalid socket returned due to error
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 unsuccess
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