Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than dhcpsapi, prefix the name with the module name and a period.
/// <summary>
/// The DhcpGetClientInfo function returns information about a specific DHCP client.
/// </summary>
/// <param name="ServerIpAddress">[in] Unicode string that specifies the IP address of the DHCP server.</param>
/// <param name="ServerIpAddress">[in] Unicode string that specifies the IP address of the DHCP server.</param;
/// <param name="SearchInfo">[in] DHCP_SEARCH_INFO structure that contains the parameters for the search. </param>
/// <param name="ClientInfo">[out] Pointer to a DHCP_CLIENT_INFO structure that contains information describing the DHCP client that most closely matches the provided search parameters. If no client is found, this parameter will be null.</param>
/// <returns>This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.</returns>
[DllImport("dhcpsapi.dll")]
static extern UInt32 DhcpGetClientInfo(
[MarshalAs(UnmanagedType.LPWStr)]
String ServerIpAddress,
ref DHCP_CLIENT_SEARCH_IP_ADDRESS si,
out IntPtr ci);
VB Signature:
''' <summary>
''' The DhcpGetClientInfo function returns information about a specific DHCP client.
''' </summary>
''' <param name="ServerIpAddress">[in] Unicode string that specifies the IP address of the DHCP server.
''' </param>
''' <param name="SearchInfo">[in] DHCP_SEARCH_INFO structure that contains the parameters for the search.
''' </param>
''' <param name="ClientInfo">[out] Pointer to a DHCP_CLIENT_INFO structure that contains information describing the DHCP client that most closely matches the provided search parameters. If no client is found, this parameter will be null.
''' </param>
''' <returns>This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.
''' </returns>
<DllImport("dhcpsapi.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> _
Public Shared Function DhcpGetClientInfo( _
ByVal ServerIpAddress As String, _
ByRef SearchInfo As DHCP_SEARCH_INFO, _
ByRef ClientInfo As IntPtr) As UInt32
End Function
Public Function GetClientInfo(ByVal serverIP As String, ByVal clientIP As String)
Dim DHCPResult As UInt32 = 0
Try
Dim searchInfo As New DHCP_SEARCH_INFO
Dim searchInfoType As DHCP_SEARCH_INFO_TYPE = DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress
searchInfo.SearchType = searchInfoType
searchInfo.ClientIpAddress = ConvertIPAddress(clientIP)
Dim hClientInfo As IntPtr
If DHCPResult = ERROR_SUCCESS And Not hClientInfo = IntPtr.Zero Then
Dim clientInfo As DHCP_CLIENT_INFO = Marshal.PtrToStructure(hClientInfo, GetType(DHCP_CLIENT_INFO))
Return clientInfo
End If
Return Nothing
Catch ex As Exception
Console.WriteLine(ex.Message)
Return Nothing
End Try
End Function
Public Shared Function ConvertIPAddress(ByVal ipAddress As String) As UInt32
Dim dot As Char() = ".".ToCharArray()
Dim zero As Char() = "0".ToCharArray()
Dim Octets As String() = ipAddress.Split(dot(0))
Dim HexIP As String = ""
For Each Octet As String In Octets
HexIP += Convert.ToString(Convert.ToInt16(Octet), 16).PadLeft(2, zero(0))
Next
Return Convert.ToUInt32(HexIP, 16)
End Function
Console.WriteLine("MAC-Adress for " + clientIp + " is " + GetClientInfoByIp(dhcpServerIP, clientIp));
}
The DhcpGetClientInfo function returns information about a specific DHCP client.
9/24/2015 5:56:00 AM - -137.246.199.200
TODO - a short description
9/17/2018 1:57:26 AM - -195.226.121.69
TODO - a short description
10/31/2007 5:00:59 AM - anonymous
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).