Welcome to mirror list, hosted at ThFree Co, Russian Federation.

IPHostEntry.cs « System.Net « System « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dd24e48b19be8af77bb599e54e253f98d25313af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// System.Net.IPHostEntry.cs
//
// Author: Mads Pultz (mpultz@diku.dk)
//
// (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;
		}
*/
	}
}