new function GetLocalIPsFamily
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@254 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
49454ea6e1
commit
a96461ce23
19
synamisc.pas
19
synamisc.pas
@ -64,6 +64,10 @@
|
|||||||
{$WARN IMPLICIT_STRING_CAST_LOSS OFF}
|
{$WARN IMPLICIT_STRING_CAST_LOSS OFF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF NEXTGEN}
|
||||||
|
{$ZEROBASEDSTRINGS OFF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
unit synamisc;
|
unit synamisc;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -115,6 +119,10 @@ function GetDNS: string;
|
|||||||
works only on windows!}
|
works only on windows!}
|
||||||
function GetIEProxy(protocol: string): TProxySetting;
|
function GetIEProxy(protocol: string): TProxySetting;
|
||||||
|
|
||||||
|
{:Return all known IP addresses of required type on the local system. Addresses are divided by
|
||||||
|
comma/comma-delimited.}
|
||||||
|
function GetLocalIPsFamily(value: TSocketFamily): string;
|
||||||
|
|
||||||
{:Return all known IP addresses on the local system. Addresses are divided by
|
{:Return all known IP addresses on the local system. Addresses are divided by
|
||||||
comma/comma-delimited.}
|
comma/comma-delimited.}
|
||||||
function GetLocalIPs: string;
|
function GetLocalIPs: string;
|
||||||
@ -146,7 +154,7 @@ begin
|
|||||||
for n := 0 to 5 do
|
for n := 0 to 5 do
|
||||||
begin
|
begin
|
||||||
b := StrToIntDef('$' + MAC[n * 2 + 1] + MAC[n * 2 + 2], 0);
|
b := StrToIntDef('$' + MAC[n * 2 + 1] + MAC[n * 2 + 2], 0);
|
||||||
HexMac := HexMac + char(b);
|
HexMac := HexMac + AnsiChar(b);
|
||||||
end;
|
end;
|
||||||
if IP = '' then
|
if IP = '' then
|
||||||
IP := cBroadcast;
|
IP := cBroadcast;
|
||||||
@ -432,7 +440,7 @@ end;
|
|||||||
|
|
||||||
{==============================================================================}
|
{==============================================================================}
|
||||||
|
|
||||||
function GetLocalIPs: string;
|
function GetLocalIPsFamily(value: TSocketFamily): string;
|
||||||
var
|
var
|
||||||
TcpSock: TTCPBlockSocket;
|
TcpSock: TTCPBlockSocket;
|
||||||
ipList: TStringList;
|
ipList: TStringList;
|
||||||
@ -442,6 +450,8 @@ begin
|
|||||||
try
|
try
|
||||||
TcpSock := TTCPBlockSocket.create;
|
TcpSock := TTCPBlockSocket.create;
|
||||||
try
|
try
|
||||||
|
if value <> SF_Any then
|
||||||
|
TcpSock.family := value;
|
||||||
TcpSock.ResolveNameToIP(TcpSock.LocalName, ipList);
|
TcpSock.ResolveNameToIP(TcpSock.LocalName, ipList);
|
||||||
Result := ipList.CommaText;
|
Result := ipList.CommaText;
|
||||||
finally
|
finally
|
||||||
@ -452,6 +462,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetLocalIPs: string;
|
||||||
|
begin
|
||||||
|
Result := GetLocalIPsFamily(SF_Any);
|
||||||
|
end;
|
||||||
|
|
||||||
{==============================================================================}
|
{==============================================================================}
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user