* Fix localport detection. Fixes issue #36849

This commit is contained in:
Michaël Van Canneyt 2026-02-15 09:31:47 +01:00
parent b4c70305bc
commit 4684e4c57e

View File

@ -801,8 +801,14 @@ begin
end;
function TLSocket.GetLocalPort: Word;
var
a: TSockAddr;
l: Integer;
begin
Result := ntohs(FAddress.IPv4.sin_port);
Result := 0;
l := SizeOf(a);
if fpGetSockName(FHandle, @a, @l) = 0 then
Result := ntohs(a.sin_port);
end;
function TLSocket.GetPeerPort: Word;