forgot this
[mono.git] / mcs / class / System / System.Net / IPHostEntry.cs
1 // System.Net.IPHostEntry.cs
2 //
3 // Author: Mads Pultz (mpultz@diku.dk)
4 //
5 // (C) Mads Pultz, 2001
6
7 using System;
8
9 namespace System.Net {
10         
11         public class IPHostEntry {
12                 private IPAddress[] addressList;
13                 private String[] aliases;
14                 private String hostName;
15                 
16                 public IPHostEntry() {
17                         hostName = "localhost";
18                         addressList = new IPAddress[1];
19                         addressList[0] = IPAddress.Loopback;
20                         aliases = new String[0];
21                 }
22                 
23                 public IPAddress[] AddressList {
24                         get { return addressList; }
25                         set { addressList = value; }
26                 }
27                 
28                 public string[] Aliases {
29                         get { return aliases; }
30                         set { aliases = value; }
31                 }
32                 
33                 public string HostName {
34                         get { return hostName; }
35                         set { hostName = value; }
36                 }
37                 
38 /* According to the .NET Framework SDK Documentation (beta 2) the following
39    methods from Object are not overrided. I implemented them before realizing
40    this but I leave the implementation here if needed in the future.
41    
42                 public override string ToString() {
43                         string res = hostName;
44                         if (addressList != null && addressList.Length > 0)
45                                 res += " [" + addressList[0] + "]";
46                         return res;
47                 }
48                 
49                 public override bool Equals(object obj) {
50                         if (obj is IPHostEntry) {
51                                 IPHostEntry h = (IPHostEntry)obj;
52                                 return hostName.Equals(h.HostName) && aliases.Equals(h.Aliases) &&
53                                         addressList.Equals(h.AddressList);
54                         }
55                         else
56                           return false;
57                 }
58                 
59                 public override int GetHashCode() {
60                         return hostName.GetHashCode();
61                 }
62                 
63                 protected new object MemberwiseClone() {
64                         IPHostEntry res = new IPHostEntry();
65                         res.AddressList = new IPAddress[addressList.Length];
66                         Array.Copy(addressList, res.AddressList, addressList.Length);
67                         res.Aliases = new String[aliases.Length];
68                         Array.Copy(aliases, res.Aliases, aliases.Length);
69                         res.HostName = hostName;
70                         return res;
71                 }
72 */
73         }
74 }
75