IPHostEntry.cs 1.6 KB

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