UdpEndPoint.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Rssdp.Infrastructure
  7. {
  8. /// <summary>
  9. /// Cross platform representation of a UDP end point, being an IP address (either IPv4 or IPv6) and a port.
  10. /// </summary>
  11. public sealed class UdpEndPoint
  12. {
  13. /// <summary>
  14. /// The IP Address of the end point.
  15. /// </summary>
  16. /// <remarks>
  17. /// <para>Can be either IPv4 or IPv6, up to the code using this instance to determine which was provided.</para>
  18. /// </remarks>
  19. public string IPAddress { get; set; }
  20. /// <summary>
  21. /// The port of the end point.
  22. /// </summary>
  23. public int Port { get; set; }
  24. /// <summary>
  25. /// Returns the <see cref="IPAddress"/> and <see cref="Port"/> values separated by a colon.
  26. /// </summary>
  27. /// <returns>A string containing <see cref="IPAddress"/>:<see cref="Port"/>.</returns>
  28. public override string ToString()
  29. {
  30. return (this.IPAddress ?? String.Empty) + ":" + this.Port.ToString();
  31. }
  32. }
  33. }