Files
mono/mcs/class/System/System.Net/IPHostEntry.cs
T
Mads Pultz d15c8ac724 * Dns.cs: Initial work submitted to repository.
* IPHostEntry.cs: Initial work submitted to repository.
---------------------------------------------------------------------

svn path=/trunk/mcs/; revision=929
2001-09-23 08:23:12 +00:00

76 lines
1.8 KiB
C#

// System.Net.IPHostEntry.cs
//
// Author: Mads Pultz ([email protected])
//
// (C) Mads Pultz, 2001
using System;
namespace System.Net {
public class IPHostEntry {
private IPAddress[] addressList;
private String[] aliases;
private String hostName;
public IPHostEntry() {
hostName = "localhost";
addressList = new IPAddress[1];
addressList[0] = IPAddress.Loopback;
aliases = new String[0];
}
public IPAddress[] AddressList {
get { return addressList; }
set { addressList = value; }
}
public string[] Aliases {
get { return aliases; }
set { aliases = value; }
}
public string HostName {
get { return hostName; }
set { hostName = value; }
}
/* According to the .NET Framework SDK Documentation (beta 2) the following
methods from Object are not overrided. I implemented them before realizing
this but I leave the implementation here if needed in the future.
public override string ToString() {
string res = hostName;
if (addressList != null && addressList.Length > 0)
res += " [" + addressList[0] + "]";
return res;
}
public override bool Equals(object obj) {
if (obj is IPHostEntry) {
IPHostEntry h = (IPHostEntry)obj;
return hostName.Equals(h.HostName) && aliases.Equals(h.Aliases) &&
addressList.Equals(h.AddressList);
}
else
return false;
}
public override int GetHashCode() {
return hostName.GetHashCode();
}
protected new object MemberwiseClone() {
IPHostEntry res = new IPHostEntry();
res.AddressList = new IPAddress[addressList.Length];
Array.Copy(addressList, res.AddressList, addressList.Length);
res.Aliases = new String[aliases.Length];
Array.Copy(aliases, res.Aliases, aliases.Length);
res.HostName = hostName;
return res;
}
*/
}
}