Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -282,7 +282,6 @@ namespace System.Net {
}
#if !TARGET_JVM
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list);
@ -291,7 +290,6 @@ namespace System.Net {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static bool GetHostName_internal(out string h_name);
#endif
static void Error_11001 (string hostName)
{
@ -362,29 +360,9 @@ namespace System.Net {
string h_name;
string[] h_aliases, h_addrlist;
#if TARGET_JVM
h_name = null;
h_aliases = null;
h_addrlist = null;
try {
java.net.InetAddress[] iaArr =
java.net.InetAddress.getAllByName(address);
if (iaArr != null && iaArr.Length > 0)
h_name = iaArr[0].getHostName();
if (iaArr != null && iaArr.Length > 0)
{
h_addrlist = new String[iaArr.Length];
for (int i = 0; i < h_addrlist.Length; i++)
h_addrlist[i] = iaArr[i].getHostAddress();
}
} catch (java.net.UnknownHostException jUHE) {
throw new SocketException((int)SocketError.HostNotFound, jUHE.Message);
}
#else
bool ret = GetHostByAddr_internal(address, out h_name, out h_aliases, out h_addrlist);
if (!ret)
Error_11001 (address);
#endif
return (hostent_to_IPHostEntry (address, h_name, h_aliases, h_addrlist));
}
@ -437,26 +415,6 @@ namespace System.Net {
{
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;
@ -465,14 +423,10 @@ namespace System.Net {
Error_11001 (hostName);
return(hostent_to_IPHostEntry(hostName, h_name, h_aliases, h_addrlist));
#endif
}
public static string GetHostName ()
{
#if TARGET_JVM
return java.net.InetAddress.getLocalHost ().getHostName ();
#else
string hostName;
bool ret = GetHostName_internal(out hostName);
@ -481,7 +435,6 @@ namespace System.Net {
Error_11001 (hostName);
return hostName;
#endif
}
[Obsolete ("Use GetHostEntry instead")]