An IPv4 or IPv6 endpoint - address, port and IPv6 zone - held WITHOUT any
platform socket type, so that it can travel through units that must not
depend on a socket API (StreamSec.Mobile.AsyncTLSReactor) and through
protocol code that compares endpoints (a datagram server telling its peers
apart). The platform units convert it to and from the native sockaddr at
the system call: stSocket (SocketAddressToNative / SocketAddressFromNative).
TEXT IS PARSED AND FORMATTED HERE, IN PASCAL, NOT BY THE SYSTEM. The system
routines differ between targets in exactly the places that matter for a
comparison: whether an IPv4 part may carry a leading zero (which some read
as octal), whether hexadecimal may be upper case, and which embedded-IPv4
forms an IPv6 address is printed in. One rule everywhere:
- IPv4 is a dotted quad of four decimal parts 0..255, no leading zeros
("0" itself is a part, "00" and "01" are not);
- IPv6 is RFC 4291 section 2.2 text, hexadecimal in either case, with at
most one "::" and optionally a dotted-quad last 32 bits, and an optional
zone "%<decimal index>" (an interface NAME is refused: resolving one
needs the system, and this unit does not call it);
- IPv6 is printed as RFC 5952 section 4 says: lower case, no leading
zeros, "::" for the longest run of two or more zero fields (the first
when two are as long), never for a single field. The dotted last 32 bits
of section 5 are used for one prefix only, the IPv4-mapped ::ffff:0:0/96,
which is the case the section names; the deprecated IPv4-compatible form
(::a.b.c.d) is printed in hexadecimal like any other address.
A name is never resolved here.Family: tAddressFamily;
Port: Word;
Addr: array [0..15] of Byte;
ScopeId: Cardinal;
function IsValid: Boolean;
function AddressText: string;
function ToString: string;
function SameAs(const aOther: tSocketAddress): Boolean;
function IsLoopback: Boolean;
function IsAny: Boolean;
inherits from Exception
(no public members)
Unknown means the platform supplied no ECN metadata. Other values name the two ECN bits; they are not a Type-of-Service or DSCP policy.