Desktop Functions: Smart Device Functions:
|
Search Results for "IPAddress" in [All]iphlpapi1: AddIPAddress
static extern int AddIPAddress(int Address, int IpMask, int IfIndex,
Declare Function AddIPAddress Lib "iphlpapi.dll" (TODO) As TODO
[DllImport("iphlpapi.dll", EntryPoint = "AddIPAddress", SetLastError = true)]
private static extern UInt32 MyAddIPAddress( UInt32 Address, UInt32 IpMaskint, int IfIndex,
AddIPAddress("1.1.100.2", "255.255.0.0", 2);
public void AddIPAddress(String IPAddress, String SubnetMask, int ifIndex)
System.Net.IPAddress IPAdd = System.Net.IPAddress.Parse(IPAddress);
System.Net.IPAddress SubNet = System.Net.IPAddress.Parse(SubnetMask);
UInt32 Result = MyAddIPAddress((uint)IPAdd.Address,
IF_TYPE_VIRTUALIPADDRESS = 112, // IBM VIPA
public static IList<IPAddress> GetIPAddresses(FAMILY family)
List<IPAddress> addresses = new List<IPAddress>();
IPAddress ipAddr = new IPAddress(saData);
Console.WriteLine( "DHCP Server : {0}", entry.DhcpServer.IpAddress.Address );
Console.WriteLine( "IP Address : {0}", entry.IpAddressList.IpAddress.Address );
Console.WriteLine( "Subnet Mask : {0}", entry.IpAddressList.IpMask.Address );
Console.WriteLine( "Default Gateway: {0}", entry.GatewayList.IpAddress.Address );
Console.WriteLine( "Primary WINS Server : {0}", entry.PrimaryWinsServer.IpAddress.Address );
Console.WriteLine( "Secondary WINS Server: {0}", entry.SecondaryWinsServer.IpAddress.Address ); DestAddr is a 32 bit representation of the four IP bytes. For .NET 1.0, you can get this from IPAddress.Address. In .NET 1.1, this is obsolete. You can use BitConverter.ToUInt32(IPAddress.GetAddressBytes()) instead.
IPAddress ipv4Address = (from thisAddress in hostInfo.AddressList
Add-Member -InputObject $objOutput -MemberType NoteProperty -Name "LocalAddress" -Value ([System.Net.IPAddress]::new($y[$i].localAddr).IPAddressToString)
Add-Member -InputObject $objOutput -MemberType NoteProperty -Name "RemoteAddress" -Value ([System.Net.IPAddress]::new($y[$i].remoteAddr).IPAddressToString)
static UInt32 GetIpAddressTable( [Out] IntPtr ipTable, [In,Out] IntPtr tableSize, bool sort);
foreach (System.Net.IPAddress strIP in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()))
string ipAddrStr = IPToString( IPAddress.NetworkToHostOrder((int)addrStruct._address) );
string ipMaskStr = IPToString( IPAddress.NetworkToHostOrder((int)addrStruct._mask) );
IPAddress ip=new IPAddress(table[index].dwAddr);
Dim ip As New IPAddress(table(index).dwAddr) 8: IPAddress
internal static UInt32 lIpFromString(string sIpAddress)
string[] octets = sIpAddress.Split(new string[] { "." }, StringSplitOptions.None);
internal static string[] GetLocalIpAddresses()
string[] localIpAddresses = new string[host.AddressList.Length];
localIpAddresses[i] = host.AddressList[i].ToString();
return localIpAddresses;
string[] localIpAddresses = GetLocalIpAddresses();
if (localIpAddresses == null)
foreach (string localAddress in localIpAddresses)
result = IpPacketFilter.PfBindInterfaceToIPAddress(interfaceHandle, PFADDRESSTYPE.PF_IPV4, ref lLocalIp);
[DllImport("iphlpapi.dll", EntryPoint = "PfBindInterfaceToIPAddress")]
static extern uint PfBindInterfaceToIPAddress(IntPtr Interface_handle, uint pfatType, ref uint IPAddress);
Declare Function PfBindInterfaceToIPAddress Lib "iphlpapi.dll" (TODO) As TODO
/// The PfBindInterfaceToIPAddress function associates an interface with the IP stack index having the specified address.
/// <param name="IPAddress">[in] Pointer to an array of bytes that specifies the IP address for the interface.</param>
internal static UInt32 lIpFromString(string sIpAddress)
string[] octets = sIpAddress.Split(new string[] { "." }, StringSplitOptions.None);
internal static string[] GetLocalIpAddresses()
string[] localIpAddresses = new string[host.AddressList.Length];
localIpAddresses[i] = host.AddressList[i].ToString();
return localIpAddresses;
string[] localIpAddresses = GetLocalIpAddresses();
if (localIpAddresses == null)
foreach (string localAddress in localIpAddresses)
result = IpPacketFilter.PfBindInterfaceToIPAddress(interfaceHandle, PFADDRESSTYPE.PF_IPV4, ref lLocalIp);
internal static UInt32 lIpFromString(string sIpAddress)
string[] octets = sIpAddress.Split(new string[] { "." }, StringSplitOptions.None);
internal static string[] GetLocalIpAddresses()
string[] localIpAddresses = new string[host.AddressList.Length];
localIpAddresses[i] = host.AddressList[i].ToString();
return localIpAddresses;
string[] localIpAddresses = GetLocalIpAddresses();
if (localIpAddresses == null)
foreach (string localAddress in localIpAddresses)
result = IpPacketFilter.PfBindInterfaceToIPAddress(interfaceHandle, PFADDRESSTYPE.PF_IPV4, ref lLocalIp); 12: SendARP
Public Shared Function GetMAC(ByVal IPAddress A
Dim addr As IPAddress = IPAddress.Parse(IPAddress)
IPAddress dst = IPAddress.Parse(
// Please do not use the IPAddress.Address property
// This API is now obsolete. --> http://msdn.microsoft.com/en-us/library/system.net.ipaddress.address.aspx Structures13: DHCP_HOST_INFO
public uint IpAddress;
Dim IpAddress As Integer 14: IP_ADAPTER_INFO
public IntPtr CurrentIpAddress;
public IP_ADDR_STRING IpAddressList;
Public CurrentIpAddress As Int32
Public IpAddressList As IP_ADDR_STRING 15: IP_ADDR_STRING
public IP_ADDRESS_STRING IpAddress;
Public IpAddress As IP_ADDRESS_STRING
public IPAddress LocalAddress
get { return new IPAddress(localAddr, LocalScopeId); }
public IPAddress RemoteAddress
get { return new IPAddress(remoteAddr, RemoteScopeId); }
public IPAddress LocalAddress
get { return new IPAddress(localAddr); }
public IPAddress RemoteAddress
get { return new IPAddress(remoteAddr); }
Public ReadOnly Property LocalAddress() As IPAddress
Return New IPAddress(localAddr)
Public ReadOnly Property RemoteAddress() As IPAddress
Return New IPAddress(remoteAddr) 18: RASPPPIP
public string szIpAddress;
Dim szIpAddress As String Constants19: PROPERTYKEY
public static PropertyKey PKEY_PNPX_IpAddress = new PropertyKey(0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003009); // VT_LPWSTR | VT_VECTOR dtl20: DTL_C_DEFINE
slot = _ipAddress;
string decip = ConvertIp(_ipAddress, ref hops); dnsapi21: DnsQuery
private const int IpAddressV6LengthBytes = 16;
private const int IpAddressV4LengthBytes = 4;
public static IDictionary<string, object>[] QueryDNSForRecordTypeSpecificNameServers(string domainName, IPAddress[] dnsServers, DnsRecordTypes recordType)
private static void MakeDnsRequest(string domainName, IPAddress[] dnsServers, QueryCompletionContext context, out IntPtr requestBuffer, out IntPtr addrBuffer, out IntPtr contextBuffer)
foreach (IPAddress addr in dnsServers)
Buffer.BlockCopy(ipv4AddressBytes, 0, sockAddrIn.SinAddr, 0, IpAddressV4LengthBytes);
sockAddrIn.SinPort = (ushort)IPAddress.HostToNetworkOrder(DNSPort);
sockAddrIn6.Sin6Port = (ushort)IPAddress.HostToNetworkOrder(DNSPort);
Buffer.BlockCopy(ipv6AddressBytes, 0, sockAddrIn6.Sin6Addr, 0, IpAddressV6LengthBytes);
string recordValue = ConvertUintToIpAddress(record.Value.Data.A.IpAddress).ToString();
string recordValue = ConvertAAAAToIpAddress(record.Value.Data.AAAA).ToString();
private static IPAddress ConvertUintToIpAddress(uint ipAddress)
ipAddress = (uint)IPAddress.NetworkToHostOrder((int)ipAddress);
addressBytes[0] = (byte)((ipAddress & 0xFF000000u) >> 24);
addressBytes[1] = (byte)((ipAddress & 0x00FF0000u) >> 16);
addressBytes[2] = (byte)((ipAddress & 0x0000FF00u) >> 8);
addressBytes[3] = (byte)(ipAddress & 0x000000FFu);
return new IPAddress(addressBytes);
private static IPAddress ConvertAAAAToIpAddress(DNS_AAAA_DATA data)
return new IPAddress(addressBytes);
public uint IpAddress;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = IpAddressV4LengthBytes)]
this.sinAddr = new byte[IpAddressV4LengthBytes];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = IpAddressV6LengthBytes)]
this.sin6Addr = new byte[IpAddressV6LengthBytes]; 22: DnsQueryEx
private const int IpAddressV6LengthBytes = 16;
private const int IpAddressV4LengthBytes = 4;
public static IDictionary<string, object>[] QueryDNSForRecordTypeSpecificNameServers(string domainName, IPAddress[] dnsServers, DnsRecordTypes recordType)
private static void MakeDnsRequest(string domainName, IPAddress[] dnsServers, QueryCompletionContext context, out IntPtr requestBuffer, out IntPtr addrBuffer, out IntPtr contextBuffer)
foreach (IPAddress addr in dnsServers)
Buffer.BlockCopy(ipv4AddressBytes, 0, sockAddrIn.SinAddr, 0, IpAddressV4LengthBytes);
sockAddrIn.SinPort = (ushort)IPAddress.HostToNetworkOrder(DNSPort);
sockAddrIn6.Sin6Port = (ushort)IPAddress.HostToNetworkOrder(DNSPort);
Buffer.BlockCopy(ipv6AddressBytes, 0, sockAddrIn6.Sin6Addr, 0, IpAddressV6LengthBytes);
string recordValue = ConvertUintToIpAddress(record.Value.Data.A.IpAddress).ToString();
string recordValue = ConvertAAAAToIpAddress(record.Value.Data.AAAA).ToString();
private static IPAddress ConvertUintToIpAddress(uint ipAddress)
addressBytes[0] = (byte)((ipAddress & 0xFF000000u) >> 24);
addressBytes[1] = (byte)((ipAddress & 0x00FF0000u) >> 16);
addressBytes[2] = (byte)((ipAddress & 0x0000FF00u) >> 8);
addressBytes[3] = (byte)(ipAddress & 0x000000FFu);
return new IPAddress(addressBytes);
private static IPAddress ConvertAAAAToIpAddress(DNS_AAAA_DATA data)
return new IPAddress(addressBytes);
public uint IpAddress;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = IpAddressV4LengthBytes)]
this.sinAddr = new byte[IpAddressV4LengthBytes];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = IpAddressV6LengthBytes)]
this.sin6Addr = new byte[IpAddressV6LengthBytes]; ws2_3223: bind
public static bool Bind(string ipAddress, int port, IntPtr socketHandle)
remoteAddress.sin_addr = inet_addr(ipAddress); 24: inet_ntoa
Public Function inet_ntoa(ByVal IpAddress As Integer) As String 25: send
public AddressIP4 IPAddress;
{ this.Family = Family; this.Port = Port; this.IPAddress = IP; this.Zero = 0; } 26: SendTo
public AddressIP4 IPAddress;
{ this.Family = Family; this.Port = Port; this.IPAddress = IP; this.Zero = 0; } dhcpsapi
string ServerIpAddress,
public uint ReservedIpAddress;
reservation.ReservedIpAddress = address;
public UInt32 DHCPIPAddress;
DhcpClientIpAddress,
Dim DHCPIPAddress As UInt32
DhcpClientIpAddress
Public Sub DeleteDHCPLease(ByVal IPAddress As String)
Dim Octets() As String = IPAddress.Split(".")
ClientInfo.DHCPSearchInfoType = DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress
ClientInfo.DHCPIPAddress = Convert.ToUInt32(HexIP, 16)
public UInt32 DHCPIPAddress;
DhcpClientIpAddress,
public static void DoDeletion(string IPAddress)
string [] Octets= IPAddress.Split(dot[0]);
ClientInfo.DHCPSearchInfoType = (int)DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress;
ClientInfo.DHCPIPAddress = Convert.ToUInt32(HexIP, 16); 29: DhcpEnumServers
outlist[i].ServerAddress = UInt32IPAddressToString(serverList[i].ServerAddress);
private string UInt32IPAddressToString(uint ipAddress)
IPAddress ipA = new IPAddress(ipAddress);
string ServerIpAddress,
Declare Unicode Function DhcpEnumSubnetClients Lib "Dhcpsapi" (ByVal ServerIpAddress As String, ByVal SubnetAddress As Integer, ByRef ResumeHandle As Integer, ByVal PreferredMaximum As Integer, ByRef ClientInfo As IntPtr, ByRef ClientsRead As Integer, ByRef ClientsTotal As Integer) As Integer
Declare Unicode Function DhcpEnumSubnetClients Lib "dhcpsapi" (ByVal ServerIpAddress As String, ByVal SubnetAddress As Int32, ByRef ResumeHandle As IntPtr, ByVal PreferredMaximum As Integer, ByRef ClientInfo As IntPtr, ByRef ClientsRead As Integer, ByRef ClientsTotal As Integer) As Integer
Dim ClientIpAddress As Int32
Dim IpAddress As Int32
public string IpAddress;
public uint IpAddress;
public uint ClientIpAddress;
string ServerIpAddress = Server;
uint SubnetMask = StringIPAddressToUInt32(Subnet);
Response = DhcpEnumSubnetClients(ServerIpAddress, SubnetMask, ref ResumeHandle,
clients_array[i].IpAddress = UInt32IPAddressToString(curr_element.ClientIpAddress);
public static uint StringIPAddressToUInt32(string ip_string)
IPAddress IpA = System.Net.IPAddress.Parse(ip_string);
public static string UInt32IPAddressToString(uint ipAddress)
IPAddress ipA = new IPAddress(ipAddress);
string ServerIpAddress,
string ServerIpAddress,
public static List<DhcpIpAddress> GetReservedIps(DhcpServer server, DhcpIpAddress subnet) {
List<DhcpIpAddress> reservations = new List<DhcpIpAddress>();
reservations.Add(new DhcpIpAddress(reservation.ReservedIpAddress)); 32: DhcpEnumSubnets
string ServerIpAddress,
Declare Unicode Function DhcpEnumSubnets Lib "Dhcpsapi" (ByVal ServerIpAddress As String, ByRef ResumeHandle As Integer, ByVal PreferredMaximum As Integer, ByRef EnumInfo As IntPtr, ByRef ElementsRead As Integer, ByRef ElementsTotal As Integer) As Integer ServerIpAddress - [in] Unicode string that specifies the IP address of the DHCP server
String ServerIpAddress = "192.168.0.250";
DHCPResult = DhcpEnumSubnets(ServerIpAddress, ref resumeHandle, 1000, out ips, ref nr, ref total);
IntPtr outArray = ipArray.IPAddresses;
DHCP_IP_ADDRESS[] ipAddressArray = new DHCP_IP_ADDRESS[size];
ipAddressArray[i] = new DHCP_IP_ADDRESS();
Marshal.PtrToStructure(current, ipAddressArray[i]);
current = (IntPtr)((int)current + Marshal.SizeOf(ipAddressArray[i]));
Console.WriteLine("{0}", UInt32IPAddressToString(ipAddressArray[i].IPAddress));
string ServerIpAddress,
public IntPtr IPAddresses;
public UInt32 IPAddress;
public static string UInt32IPAddressToString(UInt32 ipAddress)
IPAddress ipA = new IPAddress(ipAddress);
/// <param name="ServerIpAddress">[in] Unicode string that specifies the IP address of the DHCP server.</param>
String ServerIpAddress,
''' <param name="ServerIpAddress">[in] Unicode string that specifies the IP address of the DHCP server.
ByVal ServerIpAddress As String, _
Dim searchInfoType As DHCP_SEARCH_INFO_TYPE = DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress
searchInfo.ClientIpAddress = ConvertIPAddress(clientIP)
Public Shared Function ConvertIPAddress(ByVal ipAddress As String) As UInt32
Dim Octets As String() = ipAddress.Split(dot(0))
String ServerIpAddress = "192.168.0.250";
DHCP_SEARCH_INFO_TYPE searchInfoType = DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress;
searchInfo.ClientIpAddress = ConvertIPAddress("192.168.0.10");
DHCPResult = DhcpGetClientInfo(ServerIpAddress, ref searchInfo, out pClientInfo);
public static UInt32 ConvertIPAddress(string ipAddress)
string[] Octets = ipAddress.Split(dot[0]);
si.SearchType = (int)DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress ;
si.ClientIpAddress = StringIPAddressToUint32(client);
public uint StringIPAddressToUint32(string ip_string)
IPAddress ipa = IPAddress.Parse(ip_string); 34: DhcpGetVersion
string ServerIpAddress,
ByVal ServerIpAddress As String, _ ServerIpAddress (in)
string ServerIpAddress,
public uint ReservedIpAddress;
reservation.ReservedIpAddress = address; 36: DHCP_CLIENT_INFO
public uint ClientIpAddress;
public UInt32 ClientIpAddress; 38: DHCP_SEARCH_INFO
DhcpClientIpAddress = 0, httpapi
public static void BindCertificate(string ipAddress, int port, byte[] hash)
IPAddress ip = IPAddress.Parse(ipAddress); winspool40: XcvData
string szIPAddress="";
if (XcvData(hXcv, "IPAddress", IntPtr.Zero, 0, buf, 256, out cbOutputNeeded, out dwStatus))
szIPAddress= Marshal.PtrToStringAuto(buf); icmp41: IcmpSendEcho
public bool Ping(IPAddress ip) wininet42: FtpGetFile
private const string IPADDRESS_PATTERN = @"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"; |