GetHostAddress() public method

Returns this IP adress as a string in the form "%d.%d.%d.%d".
public GetHostAddress ( ) : string
return string
Exemplo n.º 1
0
 /// <summary>Retrieve all addresses of a host by it's address.</summary>
 /// <remarks>
 /// Retrieve all addresses of a host by it's address. NetBIOS hosts can
 /// have many names for a given IP address. The name and IP address make the
 /// NetBIOS address. This provides a way to retrieve the other names for a
 /// host with the same IP address.
 /// </remarks>
 /// <param name="addr">the address to query</param>
 /// <exception cref="UnknownHostException">if address cannot be resolved</exception>
 public static NbtAddress[] GetAllByAddress(NbtAddress addr)
 {
     try
     {
         NbtAddress[] addrs = Client.GetNodeStatus(addr);
         CacheAddressArray(addrs);
         return(addrs);
     }
     catch (UnknownHostException)
     {
         throw new UnknownHostException("no name with type 0x" + Hexdump.ToHexString(addr.
                                                                                     HostName.HexCode, 2) + (((addr.HostName.Scope == null) || (addr.HostName.Scope.Length
                                                                                                                                                == 0)) ? " with no scope" : " with scope " + addr.HostName.Scope) + " for host "
                                        + addr.GetHostAddress());
     }
 }
Exemplo n.º 2
0
		/// <summary>Retrieve all addresses of a host by it's address.</summary>
		/// <remarks>
		/// Retrieve all addresses of a host by it's address. NetBIOS hosts can
		/// have many names for a given IP address. The name and IP address make the
		/// NetBIOS address. This provides a way to retrieve the other names for a
		/// host with the same IP address.
		/// </remarks>
		/// <param name="addr">the address to query</param>
		/// <exception cref="UnknownHostException">if address cannot be resolved</exception>
		public static NbtAddress[] GetAllByAddress(NbtAddress addr)
		{
			try
			{
				NbtAddress[] addrs = Client.GetNodeStatus(addr);
				CacheAddressArray(addrs);
				return addrs;
			}
			catch (UnknownHostException)
			{
				throw new UnknownHostException("no name with type 0x" + Hexdump.ToHexString(addr.
					HostName.HexCode, 2) + (((addr.HostName.Scope == null) || (addr.HostName.Scope.Length
					 == 0)) ? " with no scope" : " with scope " + addr.HostName.Scope) + " for host "
					 + addr.GetHostAddress());
			}
		}