Platform SDK: Internet Protocol Helper
SendARP
The SendARP function sends an ARP request to obtain the physical address that corresponds to the specified destination IP address.
DWORD SendARP(
IPAddr DestIP, // destination IP address
IPAddr SrcIP, // IP address of sender
PULONG pMacAddr, // returned physical address
PULONG PhyAddrLen // length of returned physical addr.
);
Parameters
DestIP
[in] Specifies the destination IP address. The ARP request attempts to obtain the physical address that corresponds to this IP address.
SrcIP
[in] Specifies the IP address of the sender. This parameter is optional. The caller may specify zero for the parameter.
pMacAddr
[out] Pointer to an array of ULONG variables. The first six bytes of this array receive the physical address that corresponds to the IP address specified by the DestIP parameter.
PhyAddrLen
[out] Pointer to a ULONG variable. This variable contains the length of the physical address pointed to by the pMacAddr parameter.
Return Values
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Remarks
For information about the IPAddr data type, see Win32 Simple Data Types. To convert an IP address between dotted decimal notation and IPAddr format, use the inet_addr and inet_ntoa functions.
Example Code
The following code demonstrates how to obtain the media access control (MAC) address associated with a specified IP address.
return 0;
}
Requirements
Windows NT/2000/XP: Included in Windows 2000; Windows XP Pro; and Windows .NET Server.
Windows 95/98/Me: Unsupported.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
See Also
CreateIpNetEntry, DeleteIpNetEntry, FlushIpNetTable, SetIpNetEntry
Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)
Requirements
Windows NT/2000/XP: Included in Windows 2000; Windows XP Pro; and Windows .NET Server.
Windows 95/98/Me: Unsupported.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
See Also
CreateIpNetEntry, DeleteIpNetEntry, FlushIpNetTable, SetIpNetEntry