mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-19 19:16:30 +01:00
* Fix localport detection. Fixes issue #36849
This commit is contained in:
parent
b4c70305bc
commit
4684e4c57e
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user