ISocketFactory.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.IO;
  2. using System.Net;
  3. namespace MediaBrowser.Model.Net
  4. {
  5. /// <summary>
  6. /// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="ISocket"/> interface.
  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 <see cref="ISocket"/> implementation.</returns>
  15. ISocket CreateUdpSocket(int localPort);
  16. ISocket CreateUdpBroadcastSocket(int localPort);
  17. /// <summary>
  18. /// Creates a new unicast socket using the specified local port number.
  19. /// </summary>
  20. ISocket CreateSsdpUdpSocket(IPAddress localIp, int localPort);
  21. /// <summary>
  22. /// Creates a new multicast socket using the specified multicast IP address, multicast time to live and local port.
  23. /// </summary>
  24. /// <param name="ipAddress">The multicast IP address to bind to.</param>
  25. /// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
  26. /// <param name="localPort">The local port to bind to.</param>
  27. /// <returns>A <see cref="ISocket"/> implementation.</returns>
  28. ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
  29. Stream CreateNetworkStream(ISocket socket, bool ownsSocket);
  30. }
  31. }