System.Net.Dns.Dns.GetHostByName C# (CSharp) Method

GetHostByName() private method

private GetHostByName ( string hostName ) : IPHostEntry
hostName string
return IPHostEntry
		public static IPHostEntry GetHostByName (string hostName)
		{
			if (hostName == null)
				throw new ArgumentNullException ("hostName");
#if TARGET_JVM
			if (hostName.Length == 0)
				hostName = "localhost";
		        try {
				java.net.InetAddress[] iaArr = java.net.InetAddress.getAllByName(hostName);
				IPHostEntry host = new IPHostEntry();
				if (iaArr != null && iaArr.Length > 0)
                		{
					host.HostName = iaArr[0].getHostName();
                		    	IPAddress[] ipArr = new IPAddress[iaArr.Length];
		                    	for (int i = 0; i < iaArr.Length; i++)
                		        	ipArr[i] = IPAddress.Parse(iaArr[i].getHostAddress());

					host.AddressList = ipArr;
                		}
		                return host;
			} catch (java.net.UnknownHostException jUHE) {
				throw new SocketException((int)SocketError.HostNotFound, jUHE.Message);
			}
#else
			string h_name;
			string[] h_aliases, h_addrlist;

			bool ret = GetHostByName_internal(hostName, out h_name, out h_aliases, out h_addrlist);
			if (ret == false)
				throw new SocketException(11001);

			return(hostent_to_IPHostEntry(h_name, h_aliases, h_addrlist));
#endif
		}