ISocketFactory.cs 1.8 KB

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