ISocketFactory.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233
  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. /// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="IUdpSocket"/> interface.
  10. /// </summary>
  11. public interface ISocketFactory
  12. {
  13. /// <summary>
  14. /// Createa a new unicast socket using the specified local port number.
  15. /// </summary>
  16. /// <param name="localPort">The local port to bind to.</param>
  17. /// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
  18. IUdpSocket CreateUdpSocket(int localPort);
  19. /// <summary>
  20. /// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
  21. /// </summary>
  22. /// <param name="ipAddress">The multicast IP address to bind to.</param>
  23. /// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
  24. /// <param name="localPort">The local port to bind to.</param>
  25. /// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
  26. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "ip", Justification="IP is a well known and understood abbreviation and the full name is excessive.")]
  27. IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
  28. }
  29. }