methodtAbstractSocket.Receive
function Receive(var aBuf; aCount: Integer; aErrorCode: PInteger = nil): Integer; virtual; abstract;
Non-blocking-friendly read: application/protocol code (TLS, SSH, OCSP transports) calls this after WaitForData/ReceiveLength indicate data is available, on either a client or an accepted server connection; aErrorCode lets the caller handle a broken connection without an exception. THE THREE OUTCOMES, IDENTICAL ON EVERY PLATFORM - a caller that conflates them will eventually report a healthy connection as closed:
> 0 bytes were read.
= 0 ORDERLY CLOSE. The peer sent FIN; there will be no more data. This is the ONLY value that means closed.
< 0 and aErrorCode^ = 0 WOULD BLOCK - nothing to read right now. Both platforms can report a socket readable and then yield nothing (a discarded segment, a window probe, a concurrent ReceiveLength), so this is a normal outcome after a successful WaitForData, not a fault.
< 0 and aErrorCode^ <> 0 a real failure; the socket has been closed already. Pass aErrorCode to tell the last two apart. With aErrorCode = nil a real failure raises instead, and a would-block still returns < 0.