ISocketFactory.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Net;
  2. using System.Net.Sockets;
  3. namespace MediaBrowser.Model.Net;
  4. /// <summary>
  5. /// Implemented by components that can create specific socket configurations.
  6. /// </summary>
  7. public interface ISocketFactory
  8. {
  9. /// <summary>
  10. /// Creates a new unicast socket using the specified local port number.
  11. /// </summary>
  12. /// <param name="localPort">The local port to bind to.</param>
  13. /// <returns>A new unicast socket using the specified local port number.</returns>
  14. Socket CreateUdpBroadcastSocket(int localPort);
  15. /// <summary>
  16. /// Creates a new unicast socket using the specified local port number.
  17. /// </summary>
  18. /// <param name="bindInterface">The bind interface.</param>
  19. /// <param name="localPort">The local port to bind to.</param>
  20. /// <returns>A new unicast socket using the specified local port number.</returns>
  21. Socket CreateSsdpUdpSocket(IPData bindInterface, int localPort);
  22. /// <summary>
  23. /// Creates a new multicast socket using the specified multicast IP address, multicast time to live and local port.
  24. /// </summary>
  25. /// <param name="multicastAddress">The multicast IP address to bind to.</param>
  26. /// <param name="bindInterface">The bind interface.</param>
  27. /// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
  28. /// <param name="localPort">The local port to bind to.</param>
  29. /// <returns>A new multicast socket using the specfied bind interface, multicast address, multicast time to live and port.</returns>
  30. Socket CreateUdpMulticastSocket(IPAddress multicastAddress, IPData bindInterface, int multicastTimeToLive, int localPort);
  31. }