请问如何根据mac取ip?(100分)

  • 主题发起人 主题发起人 deardragon_2002
  • 开始时间 开始时间
D

deardragon_2002

Unregistered / Unconfirmed
GUEST, unregistred user!
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
res_ip :string;
begin
WSAStartup($101, GInitData);
Res_ip := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then
Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^ <> nildo
begin
res_ip:=StrPas(inet_ntoa(pptr^^));
Inc(I);
end;

WSACleanup;
end;

[red]我的mac是具体的16进制数,可能是多网卡的mac.哪位高手可以实现下面的函数
function GetIPFromMacAddress(AMacAddress: string): string;[/red]
 
http://compnetworking.about.com/od/networkprotocolsip/f/convertipmacadd.htm
 
Computers can determine IP addresses from MAC addresses using DHCP (and formerly other protocols like RARP and InARP).
There is no universal mechanism for an end user to determine an IP address given a known MAC address, although it can bedo
ne in certain specific situations.
实际的mac地址是可以转化的,但对于未知的,即随便给出的16进制mac地址,某中情况下虽然可以转换成功,但并没有统一的机制去实现.
 
已经做好了,是有方法的,结贴!
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
585
import
I
I
回复
0
查看
561
import
I
I
回复
0
查看
1K
import
I
后退
顶部